def assert_model(pickled_model, data): compare_svm(result["model"], pickled_model, data[0], data[1], cmp_sv=0, dcoef_tol=0)
def assert_model(pickled_model, data): if result["model"].probability: print("Comparing probabilistic svc") compare_probabilistic_svm(result["model"], pickled_model, data[0], data[1], 0, 0) else: print("comparing base svc") compare_svm(result["model"], pickled_model, data[0], data[1])
def test_svm_pickle(tmpdir, datatype, nrows, ncols): model = cuml.svm.SVC() iris = load_iris() iris_selection = np.random.RandomState(42).choice([True, False], 150, replace=True, p=[0.75, 0.25]) X_train = iris.data[iris_selection] y_train = iris.target[iris_selection] y_train = (y_train > 0).astype(datatype) model.fit(X_train, y_train) model_pickle = pickle_save_load(tmpdir, model) compare_svm(model, model_pickle, X_train, y_train, cmp_sv=0, dcoef_tol=0)