from Enel_utils import find_nearest_turbine, compute_angle from ExtractResult import Result from Transformation import Enel_powerCurveTransformation, EnelWindSpeedTransformation, \ Enel_directionVersoPowerCurveTransformation, Enel_directionPowerCurveTransformation sys.argv[1:3] = [str(x) for x in sys.argv[1:]] folder_name = sys.argv[1] filename = sys.argv[2] compute_dict = (int)(sys.argv[3]) tot_filename = folder_name+"/"+filename results = Result(tot_filename, "lasso") weights_list = results.extract_weights() mses = results.extract_mses() XTrain_transf, _ = results.extract_data_transf() XTrain_, YTrain_, XVal_, YVal_ = results.extract_train_val() saved_indexes_list = results.get_saved_indexes() XTrain_ValNoCenter, YTrainVal_noCenter, XVal_noCenter,YVal_noCenter = results.extract_train_val_no_centered() output_dict = results.extract_dict() file = "ENEL_2014/Enel_dataset.npz" results = Result(file, "lasso") XTrain, YTrain, XTest, YTest = results.extract_train_test() X_speed,_ = EnelWindSpeedTransformation().transform(XTest) Coord, Coord_turb, power_curve = results.extract_coords() angles_coord_turb,verso_turb_point = compute_angle(Coord, Coord_turb) enel_transf = Enel_powerCurveTransformation() X_angle,x_verso,_ = enel_transf.compute_angle_matrix(XTest)
if score=="r2_score": score_f = r2_score scoring = "r2" else: score_f = mean_squared_error scoring = "mean_squared_error" folder = "ENEL_2014/" ext = ".npz" file_cross_val = folder+file_name+ext results_cross_val = Result(file_cross_val, "lasso") ##get transformed data XTrain, XTest = results_cross_val.extract_data_transf() _,YTrain,_, YTest = results_cross_val.extract_train_test() ### centratura dei dati XTrain, YTrain, X_mean, y_mean, X_std = center_data(XTrain, YTrain, fit_intercept=True, normalize = True) XTest, YTest = center_test(XTest,YTest,X_mean,y_mean,X_std) ##ranking verbose = True dict_ = results_cross_val.extract_dict() weights_data = results_cross_val.extract_weights() index_mse = len(weights_data)-1 weights_data = weights_data[index_mse]
import sys from Enel_utils import find_nearest_turbine, compute_angle from ExtractResult import Result from Transformation import Enel_powerCurveTransformation, EnelWindSpeedTransformation, \ Enel_directionPowerCurveTransformation sys.argv[1:2] = [str(x) for x in sys.argv[1:2]] filename = sys.argv[1] threshold_dir = (int)(sys.argv[2]) results = Result(filename, "lasso") XTrain, YTrain, XTest, YTest = results.extract_train_test() weights_list = results.extract_weights() mses = results.extract_mses() XTrain_transf, XTest_transf = results.extract_data_transf() XTrain_, YTrain_, XVal_, YVal_ = results.extract_train_val() saved_indexes_list = results.get_saved_indexes() XTrain_ValNoCenter, YTrainVal_noCenter, XVal_noCenter,YVal_noCenter = results.extract_train_val_no_centered() enel_dict = results.extract_dict() file = "ENEL_2014/Enel_dataset.npz" results = Result(file, "lasso") ##transformation of data XTrain, YTrain, XTest, YTest = results.extract_train_test() enel_dict = results.extract_dict() Coord, Coord_turb, power_curve = results.extract_coords()