from automatminer import MatPipe from sklearn.model_selection import train_test_split import sys import pandas as pd import numpy as np import os #a=sys.argv[1] i = {'composition': [sys.argv[1]]} rpath = sys.argv[2] df = pd.DataFrame(i) filename = 'D:/FYP_files/Machine_learning/pipeline/p_files/MatPipe_predict_thirdelongation_from_composition.p' #MatPipe_predict_thirdelongation_from_composition.p #MatPipe_predict_Ultimate_fourthtime_from_composition.p pipe = MatPipe.load(filename) if __name__ == '__main__': df = pipe.predict(df) df.to_csv('%s/elongation.csv' % rpath)
random_state=20190301, test_size=0.2) test_true = test['K_VRH'] test = test.drop(columns=["K_VRH"]) # MatPipe uses an sklearn-esque BaseEstimator API for fitting pipelines and # predicting properties. Fitting a pipe trains it to the input data; predicting # with a pipe will output predictions. pipe.fit(train, target="K_VRH") # Now we can predict our outputs. They'll appear in a column called # "K_VRH predicted". test_predicted = pipe.predict(test, "K_VRH")["K_VRH predicted"] # Let's see how we did: from sklearn.metrics import mean_absolute_error mae = mean_absolute_error(test_true, test_predicted) print("MAE on {} samples: {}".format(len(test_true), mae)) # Save a text digest of the pipeline. pipe.digest(filename="digest.txt") # You can now save your model pipe.save("mat.pipe") # Then load it later and make predictions on new data pipe_loaded = MatPipe.load("mat.pipe") # You have reached the end of the basic tutorial. Please see the other tutorials # or the online documentation for more info!