# CrossCompute
measurement_table_path = 'measurements.csv'
target_folder = '/tmp'
import pandas as pd
measurement_table = pd.read_csv(measurement_table_path)
from sklearn import datasets
iris = datasets.load_iris()
from sklearn.linear_model import LogisticRegression
model1 = LogisticRegression(solver='lbfgs', multi_class='auto')
from sklearn.svm import SVC
model2 = SVC(gamma='auto')
import numpy as np
from sklearn.model_selection import cross_val_score
model1_scores = cross_val_score(model1, iris.data, iris.target, cv=5)
np.mean(model1_scores)
model2_scores = cross_val_score(model2, iris.data, iris.target, cv=5)
np.mean(model2_scores)
model = model2
model.fit(iris.data, iris.target)
X = measurement_table.values
X
y = model.predict(X)
y
choices = 'setosa', 'versicolor', 'virginica'
measurement_table['category'] = np.choose(y, choices)
from os.path import join
target_path = join(target_folder, 'results.csv')
measurement_table.to_csv(target_path, index=False)
print('result_table_path = %s' % target_path)