<jupyter_start><jupyter_text>Sample<jupyter_code>url = "https://raw.githubusercontent.com/jbrownlee/Datasets/master/pima-indians-diabetes.data.csv"
names = ['preg', 'plas', 'pres', 'skin', 'test', 'mass', 'pedi', 'age', 'class']
dataframe = pd.read_csv(url, names=names)
array = dataframe.values
X = array[:,0:8]
Y = array[:,8]
dataframe
from sklearn.linear_model import LogisticRegression
tp = TestPerformance()
tp.cross_validation(LogisticRegression(), X, Y, scoring='f1')
from sklearn.linear_model import LinearRegression
tp.cross_validation(LinearRegression(), X[:,0:7], X[:,7], scoring='neg_mean_squared_error')
from sklearn.linear_model import LogisticRegression
from sklearn.tree import DecisionTreeClassifier
from sklearn.neighbors import KNeighborsClassifier
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
from sklearn.naive_bayes import GaussianNB
from sklearn.svm import SVC

models = [LogisticRegression(), LinearDiscriminantAnalysis(), KNeighborsClassifier(), DecisionTreeClassifier(),GaussianNB(), SVC()]

tp = TestPerformance()
tp.compare_models_cross_validation(models, [X]*len(models), Y, scoring='average_precision', n=10)
from sklearn.linear_model import Lasso
from sklearn.linear_model import Ridge
from sklearn.tree import DecisionTreeRegressor
from sklearn.linear_model import LinearRegression
from sklearn.svm import SVR
from sklearn.ensemble import RandomForestRegressor

models = [LinearRegression(), Lasso(), Ridge(), DecisionTreeRegressor(), SVR(),RandomForestRegressor()]

tp = TestPerformance()
tp.compare_models_cross_validation(models, [X[:, 0:7]]*len(models), X[:, 7], scoring='neg_mean_absolute_error', n=20)
data = pd.read_csv('airbnb.csv')
data.dropna(inplace=True)
data = data[data['city']=='NYC']
data['HIGH'] = (data['log_price'] >= data['log_price'].mean()).astype('int')
X = data[['bedrooms', 'bathrooms', 'review_scores_rating', 'accommodates']]
Y1 = data['log_price']
Y2 = data['HIGH']
models = [LogisticRegression(), LinearDiscriminantAnalysis(), KNeighborsClassifier(), DecisionTreeClassifier(),GaussianNB(), SVC()]

tp = TestPerformance()
tp.compare_models_cross_validation(models, [X] * len(models), Y2, scoring='average_precision', n=10)
models = [LinearRegression(), Lasso(), Ridge(), DecisionTreeRegressor(), SVR(),RandomForestRegressor()]

tp = TestPerformance()
tp.compare_models_cross_validation(models, [X]*len(models), Y1, scoring='neg_mean_absolute_error', n=10)<jupyter_output>C:\Users\cuixu\Anaconda3\lib\site-packages\sklearn\svm\base.py:193: FutureWarning: The default value of gamma will change from 'auto' to 'scale' in version 0.22 to account better for unscaled features. Set gamma explicitly to 'auto' or 'scale' to avoid this warning.
  "avoid this warning.", FutureWarning)
C:\Users\cuixu\Anaconda3\lib\site-packages\sklearn\svm\base.py:193: FutureWarning: The default value of gamma will change from 'auto' to 'scale' in version 0.22 to account better for unscaled features. Set gamma explicitly to 'auto' or 'scale' to avoid this warning.
  "avoid this warning.", FutureWarning)
C:\Users\cuixu\Anaconda3\lib\site-packages\sklearn\svm\base.py:193: FutureWarning: The default value of gamma will change from 'auto' to 'scale' in version 0.22 to account better for unscaled features. Set gamma explicitly to 'auto' or 'scale' to avoid this warning.
  "avoid this warning.", FutureWarning)
C:\Users\cuixu\Anaconda3\lib\site-packages\sklearn\svm\base.py:193: FutureWarni[...]
{'fraction_non_alphanumeric': 0.13468208092485548, 'fraction_numerical': 0.013583815028901734, 'mean_word_length': 7.630922693266833, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '155138', 'license': 'MIT', 'n_tokens_mistral': 1162, 'n_tokens_neox': 1098, 'n_words': 272, 'path': 'TestPerformance_interface.ipynb', 'repo_name': 'raym96/personal', 'size': '3460'}