示例#1
0
 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)
示例#2
0
 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)
示例#3
0
 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))
示例#4
0
 def testNaiveBayes(self):
     ml = ML()
     t = Training("classification", "NaiveBayes", {"smoothing": 2.0}, 0.7,
                  sample_libsvm_data, "./model/bayes")
     print(ml.train_model(t))
示例#5
0
 def testGBTClassifier(self):
     ml = ML()
     t = Training("classification", "GBTClassifier", {"maxDepth": 10}, 0.7,
                  sample_libsvm_data, "./model/gbt")
     print(ml.train_model(t))
示例#6
0
 def testRandomForestClassifier(self):
     ml = ML()
     t = Training("classification", "RandomForestClassifier",
                  {"maxDepth": 10}, 0.7, sample_libsvm_data, "./model/rf")
     print(ml.train_model(t))
示例#7
0
 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))
示例#8
0
 def testBisectingKMeans(self):
     ml = ML()
     t = Training("clustering", "BisectingKMeans", {}, 0.7,
                  sample_kmeans_data, "./model/bkmeans")
     print(ml.train_model(t))
示例#9
0
 def testGBTRegressor(self):
     ml = ML()
     t = Training("regression", "GBTRegressor", {"maxDepth": 6}, 0.7,
                  sample_libsvm_data, "./model/gbtr")
     print(ml.train_model(t))
示例#10
0
 def testRandomForestRegressor(self):
     ml = ML()
     t = Training("regression", "RandomForestRegressor", {"maxDepth": 5},
                  0.7, sample_libsvm_data, "./model/rfr")
     print(ml.train_model(t))
示例#11
0
 def testDecisionTreeRegressor(self):
     ml = ML()
     t = Training("regression", "DecisionTreeRegressor", {}, 0.7,
                  sample_libsvm_data, "./model/dtr")
     print(ml.train_model(t))
示例#12
0
 def testIsotonicRegression(self):
     ml = ML()
     t = Training("regression", "IsotonicRegression", {}, 0.7,
                  sample_linear_regression_data, "./model/isotonic")
     print(ml.train_model(t))
示例#13
0
 def testLinearRegression(self):
     ml = ML()
     t = Training("regression", "LinearRegression", {"maxIter": 99}, 0.7,
                  sample_linear_regression_data, "./model/linear")
     print(ml.train_model(t))
示例#14
0
 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))
示例#15
0
 def testLDA(self):
     ml = ML()
     t = Training("clustering", "LDA", {}, 0.7, sample_lda_libsvm_data,
                  "./model/lda")
     print(ml.train_model(t))
示例#16
0
 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))
示例#17
0
 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))
示例#18
0
 def testGaussianMixture(self):
     ml = ML()
     t = Training("clustering", "GaussianMixture", {"maxIter": 99}, 0.7,
                  sample_kmeans_data, "./model/gm")
     print(ml.train_model(t))