clfs.append(( "Lightning-SVRG", lightning_clf.SVRGClassifier(alpha=alpha, eta=step_size, tol=tol, loss="log"), sag_iter_range, [], [], [], [], )) clfs.append(( "Lightning-SAG", lightning_clf.SAGClassifier(alpha=alpha, eta=step_size, tol=tol, loss="log"), sag_iter_range, [], [], [], [], )) # We keep only 200 features, to have a dense dataset, # and compare to lightning SAG, which seems incorrect in the sparse case. X_csc = X.tocsc() nnz_in_each_features = X_csc.indptr[1:] - X_csc.indptr[:-1] X = X_csc[:, np.argsort(nnz_in_each_features)[-200:]] X = X.toarray() print("dataset: %.3f MB" % (X.nbytes / 1e6))
if lightning_clf is not None and not fit_intercept: alpha = 1. / C / n_samples # compute the same step_size than in LR-sag max_squared_sum = get_max_squared_sum(X) step_size = get_auto_step_size(max_squared_sum, alpha, "log", fit_intercept) clfs.append(("Lightning-SVRG", lightning_clf.SVRGClassifier(alpha=alpha, eta=step_size, tol=tol, loss="log"), sag_iter_range, [], [], [], [])) clfs.append(("Lightning-SAG", lightning_clf.SAGClassifier(alpha=alpha, eta=step_size, tol=tol, loss="log"), sag_iter_range, [], [], [], [])) # We keep only 200 features, to have a dense dataset, # and compare to lightning SAG, which seems incorrect in the sparse case. X_csc = X.tocsc() nnz_in_each_features = X_csc.indptr[1:] - X_csc.indptr[:-1] X = X_csc[:, np.argsort(nnz_in_each_features)[-200:]] X = X.toarray() print("dataset: %.3f MB" % (X.nbytes / 1e6)) # Split training and testing. Switch train and test subset compared to # LYRL2004 split, to have a larger training dataset. n = 23149 X_test = X[:n, :]
classification_binary( linear_model.RidgeClassifier(random_state=RANDOM_SEED)), classification_binary(linear_model.RidgeClassifierCV()), classification_binary( linear_model.SGDClassifier(random_state=RANDOM_SEED)), # Lightning Linear Classifiers classification(light_clf.AdaGradClassifier(random_state=RANDOM_SEED)), classification(light_clf.CDClassifier(random_state=RANDOM_SEED)), classification( light_clf.CDClassifier( penalty="l1/l2", multiclass=True, random_state=RANDOM_SEED)), classification(light_clf.FistaClassifier()), classification(light_clf.FistaClassifier(multiclass=True)), classification(light_clf.SAGAClassifier(random_state=RANDOM_SEED)), classification(light_clf.SAGClassifier(random_state=RANDOM_SEED)), classification(light_clf.SDCAClassifier(random_state=RANDOM_SEED)), classification(light_clf.SGDClassifier(random_state=RANDOM_SEED)), classification( light_clf.SGDClassifier(multiclass=True, random_state=RANDOM_SEED)), classification_binary( light_clf.AdaGradClassifier(random_state=RANDOM_SEED)), classification_binary( light_clf.CDClassifier(random_state=RANDOM_SEED)), classification_binary(light_clf.FistaClassifier()), classification_binary( light_clf.SAGAClassifier(random_state=RANDOM_SEED)), classification_binary( light_clf.SAGClassifier(random_state=RANDOM_SEED)), classification_binary(