4.4. copro.machine_learning.fit_predict

copro.machine_learning.fit_predict(X_train, y_train, X_test, clf, config, out_dir, run_nr)[source]

Fits classifier based on training-data and makes predictions. The fitted classifier is dumped to file with pickle to be used again during projections. Makes prediction with test-data including probabilities of those predictions.

Parameters
  • X_train (array) – training-data of variable values.

  • y_train (array) – training-data of conflict data.

  • X_test (array) – test-data of variable values.

  • clf (classifier) – the specified model instance.

  • config (ConfigParser-object) – object containing the parsed configuration-settings of the model.

  • out_dir (path) – path to output folder.

  • run_nr (int) – number of fit/predict repetition and created classifier.

Returns

arrays including the predictions made and their probabilities

Return type

arrays