官术网_书友最值得收藏!

Classifying with scikit-learn

Python is an excellent language for machine learning because of its excellent libraries. In particular, scikit-learn has become the standard library for many machine learning tasks, including classification. We are going to use its implementation of decision trees in this section and in other classifiers. Fortunately, classifiers in scikit-learn follow the same API, thus making it easy to change from one to another. These objects have the following two essential methods:

  • fit(features, labels): This is the learning step and fits the parameters of the model. It takes a list-like object with features and another with labels as arguments.
  • predict(features): This method can only be called after fit and returns a prediction for one or more inputs.
主站蜘蛛池模板: 成武县| 凤庆县| 淄博市| 霞浦县| 尖扎县| 瑞安市| 枣庄市| 湘阴县| 江孜县| 曲周县| 岳西县| 金门县| 昌图县| 泰州市| 肃宁县| 房产| 深水埗区| 嘉义县| 民乐县| 江川县| 尤溪县| 滁州市| 九寨沟县| 柞水县| 普定县| 淄博市| 陇南市| 合水县| 九龙城区| 宝山区| 襄城县| 萨嘎县| 牙克石市| 金沙县| 同心县| 杭锦后旗| 安溪县| 永修县| 罗江县| 曲周县| 闻喜县|