Machine Learning Code

Regressions Logistique

# -*- coding: utf-8 -*-
'''
Created on Wed Jan 16 10:23:46 2019

@author: K
https://pythonfordatascience.org/logistic-regression-python/
'''
# module imports
from patsy import dmatrices
import pandas as pd
from sklearn.linear_model import LogisticRegression
import statsmodels.discrete.discrete_model as sm

# read in the data & create matrices
df = pd.read_csv(r"C:\Users\K\Desktop\AI\Modèles\RegressionsLogistique\binary.csv", engine='python')

predict and evaluate multivariate linear regression model

# -*- coding: utf-8 -*-
"""
Created on Tue Jan 15 11:37:53 2019
https://www.ritchieng.com/machine-learning-evaluate-linear-regression-mo...
@author: K
"""

# imports
import pandas as pd
import seaborn as sns
import statsmodels.formula.api as smf
from sklearn.linear_model import LinearRegression
from sklearn import metrics
from sklearn.cross_validation import train_test_split
import numpy as np

# allow plots to appear directly in the notebook
#%matplotlib inline

sklearn linear_model LinearRegression on Salaries

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import statsmodels.api as sm
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
from sklearn.metrics import r2_score
import warnings
#from IPython import get_ipython
#ipy = get_ipython()
#if ipy is not None:
#    ipy.run_line_magic('matplotlib', 'inline')
sns.set()
#%matplotlib inline

df = pd.read_csv("./SalaryData1.csv")
print(df.shape)
print(df.isnull().values.any())

Pages

Subscribe to Machine Learning Code