Beispiel #1
0
    print 'Please give frovedis_server calling command as the first argument \n(e.g. "mpirun -np 2 -x /opt/nec/nosupport/frovedis/ve/bin/frovedis_server")'
    quit()
FrovedisServer.initialize(argvs[1])

mat = pd.read_csv("./input/train_1.csv")
lbl = np.array([1, 0, 0, 1], dtype=np.float64)
lbl1 = np.array([0.2, 0.3, 0.8, 0.6])
c_temp = 0
r_temp = 0

# fitting input matrix and label on DecisionTree Classifier object
dtc1 = DecisionTreeClassifier()
try:
    dtc = dtc1.fit(mat, lbl)
except TypeError, e:
    c_temp = 1

# fitting input matrix and label on DecisionTree Regressor object
dtr1 = DecisionTreeRegressor()
try:
    dtr = dtr1.fit(mat, lbl1)
except TypeError, e:
    r_temp = 1

if c_temp == 1 and r_temp == 1:
    print("Status : Passed")
else:
    print("Status : Failed")

FrovedisServer.shut_down()
Beispiel #2
0
                 class_weight=None, presort=False, verbose = 0)
dtc = dtc1.fit(mat,lbl)
dtc.debug_print()

# predicting on train model
print("predicting on DecisionTree classifier model: ")
dtcm =  dtc.predict(mat[2:3])
print dtcm
print("Accuracy score for predicted DecisionTree Classifier model")
print dtc.score(mat,lbl)


# fitting input matrix and label on DecisionTree Regressor object
dtr1 = DecisionTreeRegressor(criterion='mse', splitter='best',
                 max_depth=None, min_samples_split=2, min_samples_leaf=1,
                 min_weight_fraction_leaf=0.0, max_features=None, random_state=None,
                 max_leaf_nodes=1, min_impurity_decrease=0.0, min_impurity_split=None,
                 class_weight=None, presort=False, verbose = 0)
lbl1 = np.array([1.2,0.3,1.1,1.9])
dtr = dtr1.fit(mat,lbl1)
dtr.debug_print()

# predicting on train model
print("predicting on  DecisionTree Regressor model: ")
dtrm = dtr.predict(mat[2:3])
print dtrm
print("Root mean square for predicted DecisionTree Regressor model")
print dtr.score(mat,lbl1)

if (lbl[2] == dtcm) and (lbl1[2] == dtrm):
  print("Status: Passed")
Beispiel #3
0
lbl = np.array([0.0, 1.0, 1.0, 0.0])

# fitting input matrix and label on DecisionTree Classifier object
dtc1 = DecisionTreeClassifier(max_depth=None)
dtc = dtc1.fit(mat, lbl)
dtc.debug_print()

# predicting on train model
print("predicting on DecisionTree classifier model: ")
dtcm = dtc.predict(mat)
print dtcm
print("Accuracy score for predicted DecisionTree Classifier model")
print dtc.score(mat, lbl)

# fitting input matrix and label on DecisionTree Regressor object
dtr1 = DecisionTreeRegressor(max_depth=None)
lbl1 = np.array([1.2, 0.3, 1.1, 1.9])
dtr = dtr1.fit(mat, lbl1)
dtr.debug_print()

# predicting on train model
print("predicting on  DecisionTree Regressor model: ")
dtrm = dtr.predict(mat)
print dtrm
print("Root mean square for predicted DecisionTree Regressor model")
print dtr.score(mat, lbl1)

if (lbl == dtcm).all() and (dtrm == lbl1).all(): print("Status: Passed")
else: print("Status: Failed")

#clean-up
Beispiel #4
0
                    [0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0],
                    [0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0],
                    [1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0]])
lbl = np.array([0.0, 1.0, 1.0, 0.0])
lbl1 = np.array([0.2,0.1,0.8,0.6])
c_temp = 0
r_temp = 0

# fitting input matrix and label on DecisionTree Classifier object
dtc1 = DecisionTreeClassifier(min_samples_leaf=-1)
try:
  dtc = dtc1.fit(mat,lbl)
except ValueError, e:
  c_temp = 1

# fitting input matrix and label on DecisionTree Regressor object
dtr1 = DecisionTreeRegressor(min_samples_leaf=-1)
try:
  dtr = dtr1.fit(mat,lbl1)
except ValueError, e:
  r_temp = 1


if c_temp == 1 and r_temp == 1:
  print("Status : Passed")
else:
  print("Status : Failed")

FrovedisServer.shut_down()

Beispiel #5
0
# fitting input matrix and label on DecisionTree Classifier object
dtc = DecisionTreeClassifier(criterion='gini', max_depth=5)
dtc.fit(mat, lbl)
#dtc.debug_print()

# predicting on train model
print("predicting on DecisionTree classifier model: ")
print(dtc.predict(mat))
print("predicting probability on DecisionTree classifier model: ")
print(dtc.predict_proba(mat))
print("prediction accuracy: %.4f" % (dtc.score(mat, lbl)))

# regression data
from sklearn.datasets import load_boston
mat, lbl = load_boston(return_X_y=True)

# fitting input matrix and label on DecisionTree Regressor object
dtr = DecisionTreeRegressor(criterion='mse', max_depth=5)
dtr.fit(mat, lbl)
#dtr.debug_print()

# predicting on train model
print("predicting on  DecisionTree Regressor model: ")
print(dtr.predict(mat))
print("prediction score: %.4f" % (dtr.score(mat, lbl)))

#clean-up
#dtc.release()
#dtr.release()
FrovedisServer.shut_down()
Beispiel #6
0
                    [0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0],
                    [0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0],
                    [1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0]])
lbl = np.array([0.0, 1.0, 1.0, 0.0])
lbl1 = np.array([0.2,0.1,0.8,0.6])
c_temp = 0
r_temp = 0

# fitting input matrix and label on DecisionTree Classifier object
dtc1 = DecisionTreeClassifier(criterion='mse')
try:
  dtc = dtc1.fit(mat,lbl)
except ValueError, e:
  c_temp = 1


# fitting input matrix and label on DecisionTree Regressor object
dtr1 = DecisionTreeRegressor(criterion='gini')
try:
  dtr = dtr1.fit(mat,lbl1)
except ValueError, e:
  r_temp = 1

if c_temp == 1 and r_temp == 1:
  print("Status : Passed")
else:
  print("Status : Failed")

FrovedisServer.shut_down()