本文整理汇总了Python中sklearn.ensemble.RandomForestRegressor.fitgurobi方法的典型用法代码示例。如果您正苦于以下问题:Python RandomForestRegressor.fitgurobi方法的具体用法?Python RandomForestRegressor.fitgurobi怎么用?Python RandomForestRegressor.fitgurobi使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sklearn.ensemble.RandomForestRegressor
的用法示例。
在下文中一共展示了RandomForestRegressor.fitgurobi方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _fit
# 需要导入模块: from sklearn.ensemble import RandomForestRegressor [as 别名]
# 或者: from sklearn.ensemble.RandomForestRegressor import fitgurobi [as 别名]
def _fit(self, image, dot, tags, boxConstraints = []):
img = self.normalize(image)
if type(boxConstraints) is dict:
boxConstraints["boxFeatures"] = self.normalize(boxConstraints["boxFeatures"])
numFeatures = img.shape[1]
if self._method == "RandomForest":
from sklearn.ensemble import RandomForestRegressor as RFR
regressor = RFR(n_estimators=self._ntrees,max_depth=self._maxdepth)
regressor.fit(img, dot)
elif self._method == "svrBoxed-gurobi":
regressor = RegressorGurobi(C = self._C, epsilon = self._epsilon)
regressor.fit(img, dot, tags, self.getOldBoxConstraints(boxConstraints, numFeatures
))
#elif self._method == "svrBoxed-gurobi":
# regressor = RegressorGurobi(C = self._C, epsilon = self._epsilon)
# regressor.fit(img, dot, tags, self.getOldBoxConstraints(boxConstraints, numFeatures
# ))
elif self._method == "BoxedRegressionGurobi":
regressor = RegressorC(C = self._C, epsilon = self._epsilon)
regressor.fitgurobi(img, dot, tags, boxConstraints)
elif self._method == "BoxedRegressionCplex":
regressor = RegressorC(C = self._C, epsilon = self._epsilon)
regressor.fitcplex(img, dot, tags, boxConstraints)
return regressor