def GET(self):
        if librarian.is_traktor_running():
            response = {"status": "error", "message": "Please quit Traktor first."}
        else:
            cleaner = Cleaner(Library.instance())
            cleaner.remove_duplicates()
            logger.debug(u"Duplicate removal complete")

            response = cleaner.get_result()
            response["status"] = "ok"
        web.header("Cache-Control", "no-cache")
        return json.dumps(response)
Esempio n. 2
0
def main():
    try:
        lib = Library(conf.library_dir)

        if conf.action == "clean":
            cleaner = Cleaner(lib)
            print("Removing duplicates..."),
            cleaner.remove_duplicates()
            print("DONE")

            cleaner.report()

            if not conf.test:
                lib.flush()
                print("\nTraktor library updated.")
            else:
                print("\nTest run. No changes made to the library.")
        elif conf.action == "export":
            exporter = Exporter(lib, conf.export_dir)
            exporter.export()

    except Exception as e:
        logger.error(e, exc_info=False)
Esempio n. 3
0
import os

congress_id = ""
if len(sys.argv) > 3 or len(sys.argv) < 2:
    print("Please Enter valid parameter:")
    print("Parameter: Congress term number")
    print("Option: --skip, avoid data cleaning")
    sys.exit()

if len(sys.argv) == 2:
    congress_id = str(sys.argv[1])
    if os.path.isfile("rawData/" + "speeches_" + congress_id +
                      ".txt") and os.path.isfile("rawData/" + congress_id +
                                                 "_SpeakerMap.txt"):
        print("cleaning ....")
        data_cleaner = Cleaner([congress_id])
        data_cleaner.clean_pipeline()
        print("classifying ....")
        congress_classifier = Classifier([congress_id])
        congress_classifier.base_pipeline()
        print("done.")
        sys.exit()
    else:
        print(
            "There are no speeches and speakerMap text file to process for congress "
            + congress_id)
        print(
            "Please put the target congress raw text data into rawData directory"
        )
        sys.exit()
Esempio n. 4
0
File: model.py Progetto: pah8p/ML
    [plot.fitted_histogram, y['LogSalePrice']],
    #	[plot.qq, y['SalePrice']],
    #	[plot.qq, y['Log1SalePrice']],
]
#plot.view(plots)

#y.to_csv('y.csv', index=False)
y_np = y.drop('SalePrice', axis=1).to_numpy()

train_id = x_train['Id']
test_id = x_test['Id']

x_train.drop('Id', axis=1, inplace=True)
x_test.drop('Id', axis=1, inplace=True)

cleaner = Cleaner(x_train, x_test)
cleaner.clean(variables)

#linear = regression.build('Linear')
#linear_cv = regression.cross_validate(linear, cleaner.x_train_np, y_np)
#print('LINEAR', linear_cv)

lasso = regression.build('Lasso', alpha=0.002)
lasso_cv = regression.cross_validate(lasso, cleaner.x_train_np, y_np)

elastic_net = regression.build('ElasticNet', alpha=0.002)
elastic_net_cv = regression.cross_validate(elastic_net, cleaner.x_train_np,
                                           y_np)

kernel_ridge = regression.build('KernelRidge')
kernel_ridge_cv = regression.cross_validate(kernel_ridge, cleaner.x_train_np,