e2f021a5e4444befdb9e5926b96bc96c408faa85,examples/acp_regression_tree.py,,,#,24
Before Change
// Define models
// -----------------------------------------------------------------------------
models = { "ACP-RandomSubSampler" : AggregatedCp(
IcpRegressor(
RegressorNc(
DecisionTreeRegressor())),
RandomSubSampler()),
"ACP-CrossSampler" : AggregatedCp(
IcpRegressor(
RegressorNc(
DecisionTreeRegressor())),
CrossSampler()),
"ACP-BootstrapSampler" : AggregatedCp(
IcpRegressor(
RegressorNc(
DecisionTreeRegressor())),
BootstrapSampler())
}
// -----------------------------------------------------------------------------
// Train, predict and evaluate
// -----------------------------------------------------------------------------
for name, model in models.iteritems():
model.fit(data.data[train, :], data.target[train])
prediction = model.predict(data.data[test, :])
prediction_sign = model.predict(data.data[test, :],
significance=significance)
table = np.vstack((prediction_sign.T, truth)).T
df = pd.DataFrame(table, columns=columns)
print("\n{}".format(name))
print("Error rate: {}".format(reg_mean_errors(prediction,
truth,
After Change
// Define models
// -----------------------------------------------------------------------------
models = { "ACP-RandomSubSampler" : AggregatedCp(
IcpRegressor(
RegressorNc(
RegressorAdapter(DecisionTreeRegressor()))),
RandomSubSampler()),
"ACP-CrossSampler" : AggregatedCp(
IcpRegressor(
RegressorNc(
RegressorAdapter(DecisionTreeRegressor()))),
CrossSampler()),
"ACP-BootstrapSampler" : AggregatedCp(
IcpRegressor(
RegressorNc(
RegressorAdapter(DecisionTreeRegressor()))),
BootstrapSampler())
}
// -----------------------------------------------------------------------------
// Train, predict and evaluate
// -----------------------------------------------------------------------------
for name, model in models.iteritems():
model.fit(data.data[train, :], data.target[train])
prediction = model.predict(data.data[test, :])
prediction_sign = model.predict(data.data[test, :],
significance=significance)
table = np.vstack((prediction_sign.T, truth)).T
df = pd.DataFrame(table, columns=columns)
print("\n{}".format(name))
print("Error rate: {}".format(reg_mean_errors(prediction,
truth,
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 3
Instances
Project Name: donlnz/nonconformist
Commit Name: e2f021a5e4444befdb9e5926b96bc96c408faa85
Time: 2016-09-09
Author: henrik.linusson@gmail.com
File Name: examples/acp_regression_tree.py
Class Name:
Method Name: