def multiclass_linear_svm_ex(): wm = get_workspace(id=id) wm.show_metadata() X = wm.load("features.npy",online=False) y = wm.load("labels.npy") X = norm_cols(X) lsvm = linear_svm(param_grid=[ {'C': [1e-1,5e-1,1,5,1e1,5e3,1e4]} ],n_class_samples=30,n_test_samples=50) lsvm(X,y)
def multiclass_linear_svm_ex(): wm = get_workspace(id=id) wm.show_metadata() X = wm.load("features.npy",online=False) y = wm.load("labels.npy") X = norm_cols(X) lsvm = linear_svm(param_grid=[{'C': [1e-1, 5e-1, 1, 5, 1e1, 5e3, 1e4]}], n_class_samples=30, n_test_samples=50) lsvm(X, y)
def ScSPM_SRC(): wm = get_workspace(id=id) wm.show_metadata() X = wm.load("features.npy", online=False) y = wm.load("labels.npy") X = norm_cols(X) se = sparse_encoder(algorithm='group_omp',params={'n_groups':1},n_jobs=8) ckc = class_ksvd_coder(atom_ratio=1, sparse_coder=se, non_neg=False,max_iter=5, n_cycles=1, n_jobs=n_jobs, mmap=False,approx=True,verbose=True) sc = src_classifier(class_dict_coder=None,sparse_coder=se, n_class_samples=30,n_test_samples=None, method="global",mmap=False,n_jobs=n_jobs) sc(X, y)
def lc_ksvd_ex(): wm = get_workspace(id=id) wm.show_metadata() X = wm.load("features.npy",online=False) y = wm.load("labels.npy") X = norm_cols(X) se = sparse_encoder(algorithm='bomp', params={"n_nonzero_coefs": 30}, n_jobs=8) ckc = class_ksvd_coder(atom_ratio=1, sparse_coder=se,non_neg=False, max_iter=5, n_cycles=1, n_jobs=8, mmap=False, approx=True, verbose=True) lc = lc_ksvd_classifier(class_dict_coder=ckc, sparse_coder=se, approx=True, max_iter=4, n_class_samples=30,n_test_samples=None, verbose=True, mmap=False, n_jobs=8, param_grid=[{'alpha': [1], 'beta': [1]}]) lc(X, y)
def ScSPM_SRC(): wm = get_workspace(id=id) wm.show_metadata() X = wm.load("features.npy", online=False) y = wm.load("labels.npy") X = norm_cols(X) se = sparse_encoder(algorithm='group_omp',params={'n_groups':1},n_jobs=8) ckc = class_ksvd_coder(atom_ratio=1, sparse_coder=se, non_neg=False, max_iter=5, n_cycles=1, n_jobs=4, mmap=False, approx=True, verbose=True) sc = src_classifier(class_dict_coder=None, sparse_coder=se, n_class_samples=30, n_test_samples=None, method="global", mmap=False, n_jobs=4) sc(X, y)
def lc_ksvd_ex(): wm = get_workspace(id=id) wm.show_metadata() X = wm.load("features.npy", online=False) y = wm.load("labels.npy") X = norm_cols(X) se = sparse_encoder(algorithm='bomp', params={"n_nonzero_coefs": 30}, n_jobs=8) ckc = class_ksvd_coder(atom_ratio=1, sparse_coder=se,non_neg=False, max_iter=5, n_cycles=1, n_jobs=8, mmap=False, approx=True, verbose=True) lc = lc_ksvd_classifier(class_dict_coder=ckc, sparse_coder=se, approx=True, max_iter=4, n_class_samples=30,n_test_samples=None, verbose=True, mmap=False, n_jobs=8, param_grid=[{'alpha': [1], 'beta': [1]}]) lc(X, y)