Ejemplo n.º 1
0
    T = basic.get_X_from_dataframe(test_set)
    Id = basic.get_Id_from_test_dataframe(test_set)


    #Get a classifier. Later, it will be a pipeline
    pipeline = bayes.GaussianNB()

    #TODO tune pipeline metaparameters.
    #The most time consuming part! We have to be really creative here!


    #Once the metaparameters were found, set them and fit ("learn") the training set
    pipeline.fit(X,Y)

    #Sometimes a little time consuming but not very much
    predicted_proba = pipeline.predict_proba(T)

    #Build nicely the pandas so we can write a nice csv
    output = basic.build_pandas_output(Id,predicted_proba,class_labels)

    output_file_name = fh.get_out_path("cv_Prediction_Attempt_01.08.2015.csv")
    output.to_csv(output_file_name,index=False)

    #Write the file, ready to be submitted
    print "Done"





Ejemplo n.º 2
0
def test_how_to_write_a_file():
    file_name = fh.get_out_path("sample_writable_file.txt")
    with open(file_name,"w") as file:
        file.write("Some string in the file\n")