当前位置: 首页>>代码示例>>Python>>正文


Python BigML.pprint方法代码示例

本文整理汇总了Python中bigml.api.BigML.pprint方法的典型用法代码示例。如果您正苦于以下问题:Python BigML.pprint方法的具体用法?Python BigML.pprint怎么用?Python BigML.pprint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在bigml.api.BigML的用法示例。


在下文中一共展示了BigML.pprint方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: BigML

# 需要导入模块: from bigml.api import BigML [as 别名]
# 或者: from bigml.api.BigML import pprint [as 别名]
#@see: http://bigml.readthedocs.org/en/latest/#local-predictions
from bigml.api import BigML
api = BigML('smarkit',"37b903bf765414b5e1c3164061cee5fa57e7e6ad",storage='./storage')

source = api.create_source('./data/red_bule_balls_2003.csv')
api.pprint(api.get_fields(source))
dataset = api.create_dataset(source)
model = api.create_model(dataset)
prediction = api.create_prediction(model, {'red':[1,2,3,4,5,6],'blue':7})
#prediction
api.pprint(prediction)
开发者ID:daiyoko,项目名称:LotteryPrediction,代码行数:13,代码来源:BigML.py

示例2:

# 需要导入模块: from bigml.api import BigML [as 别名]
# 或者: from bigml.api.BigML import pprint [as 别名]
model = api.create_ensemble(train_dataset)

# <codecell>

# Read the test dataset
test_X = pd.read_csv('test.csv')
test_y = pd.read_csv('test_target.csv')
test_set = test_X.T.to_dict().values()

# <codecell>

# Holds predictions from all the samples in test set
prediction = []

for x in test_set:
    # Get predictions for complete test set
    predict = api.create_prediction(model, x)
    api.pprint(predict)
    # Append it to the prediction list
    prediction.append(predict['object'].get('output'))

# <codecell>

# Classification error
y = np.array(test_y.target)
yhat = np.array(prediction)

error = np.sum(y == yhat)/float(len(y))
print error

开发者ID:rishy,项目名称:phishing-websites,代码行数:31,代码来源:BigML_classification.py

示例3: Model

# 需要导入模块: from bigml.api import BigML [as 别名]
# 或者: from bigml.api.BigML import pprint [as 别名]
# model = api.get_model('model/563a1c7a3cd25747430023ce')
# prediction = api.create_prediction(model, {'petal length': 4.07, 'sepal width': 3.15, 'petal width': 1.51})

# local_model = Model('model/56430eb8636e1c79b0001f90', api=api)
# prediction = local_model.predict({'petal length': 0.96, 'sepal width': 4.1, 'petal width': 2.52}, 2, add_confidence=True, multiple=3)

#local_model = Ensemble('ensemble/563219b8636e1c5eca006d38', api=api)
# local_model = Ensemble('ensemble/564a081bc6c19b6cf3011c60', api=api)
#prediction = local_model.predict({'petal length': 0.96, 'sepal width': 2.25, 'petal width': 1.51, 'sepal length': 6.02}, method=2, add_confidence=True)

#local_model = Ensemble('ensemble/5666fb621d55051209009f0f', api=api)
#prediction = local_model.predict({'Salary': 18000000, 'Team' : 'Atlanta Braves'}, method=0, add_confidence=True)
#local_model = Ensemble('ensemble/566954af1d5505120900bf69', api=api)
#prediction = local_model.predict({'Price' : 5.8, 'Grape' : 'Pinot Grigio', 'Rating' : 89, 'Country' : 'Italy'}, method=1, add_confidence=True, add_distribution=True)

# local_ensemble = Ensemble('ensemble/564623d4636e1c79b00051f7', api=api)
# prediction = local_ensemble.predict({'Price' : 5.8, 'Grape' : 'Pinot Grigio', 'Country' : 'Italy', 'Rating' : 92}, True)

# local_anomaly = Anomaly('anomaly/564c5a76636e1c3d52000007', api=api)
# prediction = local_anomaly.anomaly_score({'petal length': 4.07, 'sepal width': 3.15, 'petal width': 1.51, 'sepal length': 6.02, 'species': 'Iris-setosa'}, True)
# prediction = local_anomaly.anomaly_score({'petal length': 0.96, 'sepal width': 4.1, 'petal width': 2.51, 'sepal length': 6.02, 'species': 'Iris-setosa'}, True)
# prediction = local_anomaly.anomaly_score({'petal length': 0.96, 'sepal width': 4.1, 'petal width': 2.51}, True)

logistic_regression = LogisticRegression(
    'logisticregression/5697c1179ed2334090003217')
prediction = logistic_regression.predict({"petal length": 4.07, "petal width": 14.07,
                             "sepal length": 6.02, "sepal width": 3.15})

api.pprint(prediction)
开发者ID:bigmlcom,项目名称:bigml-objc,代码行数:31,代码来源:pythonTests.py


注:本文中的bigml.api.BigML.pprint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。