def testLinearSVC(self): ml = ML() t = Training("classification", "LinearSVC", { "maxIter": 10, "regParam": 0.3 }, 0.7, sample_libsvm_data, "./model/svc") ml.train_model(t)
def testMultilayerPerceptronClassifier(self): # TODO param layers is neccesary ml = ML() t = Training("classification", "MultilayerPerceptronClassifier", {"layers": [4, 5, 4, 3]}, 0.7, sample_multiclass_classification_data, "./model/mlp") print(ml.train_model(t))
def testLogisticRegression(self): ml = ML() t = Training( "classification", "LogisticRegression", { "maxIter": 10, "regParam": 0.3, "elasticNetParam": 0.8, "family": "multinomial" }, 0.7, iris, "./model/lr") ml.train_model(t)
def testCSV(self): ml = ML() # ml.compute_statistics(iris, "sepallength") t = Training( "classification", "LogisticRegression", { "maxIter": 10, "regParam": 0.3, "elasticNetParam": 0.8, "family": "multinomial" }, 0.7, iris, "./model/lr") # ml.train_model(t) ml.model_predict_single(t, iris)
def testRandomForestClassifier(self): ml = ML() t = Training("classification", "RandomForestClassifier", {"maxDepth": 10}, 0.7, sample_libsvm_data, "./model/rf") print(ml.train_model(t))
def testGeneralizedLinearRegression(self): ml = ML() t = Training("regression", "GeneralizedLinearRegression", {"regParam": 0.3}, 0.7, sample_linear_regression_data, "./model/glr") print(ml.train_model(t))
def testAFTSurvivalRegression(self): # TODO not have test data ml = ML() t = Training("regression", "AFTSurvivalRegression", {}, 0.7, sample_libsvm_data, "./model/aftsr") print(ml.train_model(t))
def testGaussianMixture(self): ml = ML() t = Training("clustering", "GaussianMixture", {"maxIter": 99}, 0.7, sample_kmeans_data, "./model/gm") print(ml.train_model(t))
def testDecisionTreeRegressor(self): ml = ML() t = Training("regression", "DecisionTreeRegressor", {}, 0.7, sample_libsvm_data, "./model/dtr") print(ml.train_model(t))
def testIsotonicRegression(self): ml = ML() t = Training("regression", "IsotonicRegression", {}, 0.7, sample_linear_regression_data, "./model/isotonic") print(ml.train_model(t))
def testLinearRegression(self): ml = ML() t = Training("regression", "LinearRegression", {"maxIter": 99}, 0.7, sample_linear_regression_data, "./model/linear") print(ml.train_model(t))
"nullable": True, "type": "double" }, { "metadata": { "label": True }, "name": "class", "nullable": True, "type": "string" }], "type": "struct" }) # {"fields":[{"metadata":{},"name":"sepallength","nullable":true,"type":"double"},{"metadata":{},"name":"sepalwidth","nullable":true,"type":"double"},{"metadata":{},"name":"petallength","nullable":true,"type":"double"},{"metadata":{},"name":"petalwidth","nullable":true,"type":"double"},{"metadata":{"label":true},"name":"class","nullable":true,"type":"string"}],"type":"struct"} ml = ML() # ml.read_source(s) # schema_json = ml.get_schema_json(s) # print(schema_json) # s.schema_json = schema_json t = Training( "classification", "LogisticRegression", { "maxIter": 10, "regParam": 0.3, "elasticNetParam": 0.8, "family": "multinomial" }, 0.7, s, "./test") # ml.train_model(t) ml.model_predict(t, s) # ml.compute_statistics(s, "sepallength")
def testALS(self): ml = ML() t = Training("recommendation", "ALS", {"maxIter": 9}, 0.7, test, "./model/als") ml.model_predict_single() print(ml.train_model(t))
def testLDA(self): ml = ML() t = Training("clustering", "LDA", {}, 0.7, sample_lda_libsvm_data, "./model/lda") print(ml.train_model(t))
def testBisectingKMeans(self): ml = ML() t = Training("clustering", "BisectingKMeans", {}, 0.7, sample_kmeans_data, "./model/bkmeans") print(ml.train_model(t))
def testGBTClassifier(self): ml = ML() t = Training("classification", "GBTClassifier", {"maxDepth": 10}, 0.7, sample_libsvm_data, "./model/gbt") print(ml.train_model(t))
def testNaiveBayes(self): ml = ML() t = Training("classification", "NaiveBayes", {"smoothing": 2.0}, 0.7, sample_libsvm_data, "./model/bayes") print(ml.train_model(t))
def testRandomForestRegressor(self): ml = ML() t = Training("regression", "RandomForestRegressor", {"maxDepth": 5}, 0.7, sample_libsvm_data, "./model/rfr") print(ml.train_model(t))
def testOneVsRest(self): # TODO param classifier is neccesary ml = ML() t = Training("classification", "OneVsRest", {"maxIter": 10}, 0.7, sample_multiclass_classification_data, "./model/ovr") print(ml.train_model(t))
def testGBTRegressor(self): ml = ML() t = Training("regression", "GBTRegressor", {"maxDepth": 6}, 0.7, sample_libsvm_data, "./model/gbtr") print(ml.train_model(t))