예제 #1
0
    def setUp(self):

        self.date_string = "2008-08-13"
        self.date = pd.to_datetime(self.date_string)
        self.start_df = format_nrel_dataframe("../data/2003_2016.csv")
        self.lag_features = [
            'Temperature', 'Clearsky DHI', 'Clearsky DNI', 'Clearsky GHI',
            'Cloud Type', 'Dew Point', 'DHI', 'DNI', 'Fill Flag', 'GHI',
            'Relative Humidity', 'Solar Zenith Angle', 'Surface Albedo',
            'Pressure', 'Precipitable Water', 'Wind Direction', 'Wind Speed'
        ]
        self.intra_df = create_lagged_features(self.start_df,
                                               self.lag_features, 4, 30)
        self.df = create_future_target(self.intra_df, 'DNI', 1, 30)
        self.columns = [
            'Year', 'DOY', 'Month', 'Hour', 'Minute', 'Date', 'final_date',
            'DNI_T_minus_90', 'DNI_T_minus_60'
        ]
        self.target = 'DNI_T_plus30'
        self.num_units = 2
예제 #2
0
def predict_x_mins(shift, row_time_steps=30):
    '''
    Reads and formats NREL data, and creates a target column for modeling
    that is the future values of DNI.

    shift * row_time_steps = number of minutes target column will be in the
    future.

    Example:
        [1]: df = predict_x_mins(shift=4, row_time_steps=30)
            # 4 * 30 = 120. The target will be DNI 120 minutes into
            # the future

    Parameters:
    ----------
    shift : (int)
        The number of observations to shift backward
    row_time_steps : (int)
        The time difference (in minutes) from one observation to the next in
        the DataFrame specified

    Returns:
    ----------
    df : (Pandas DataFrame)
        DataFrame with new column added
    '''
    df = format_nrel_dataframe("../data/2003_2016.csv")
    lag_features = [
        'Temperature', 'Clearsky DHI', 'Clearsky DNI', 'Clearsky GHI',
        'Cloud Type', 'Dew Point', 'DHI', 'DNI', 'Fill Flag', 'GHI',
        'Relative Humidity', 'Solar Zenith Angle', 'Surface Albedo',
        'Pressure', 'Precipitable Water', 'Wind Direction', 'Wind Speed'
    ]
    df = create_lagged_features(df, lag_features, 4, 30)
    df = create_future_target(df, 'DNI', shift, row_time_steps)
    return df
예제 #3
0
import os
import sys
import pickle
parentPath = os.path.abspath("..")
if parentPath not in sys.path:
    sys.path.insert(0, parentPath)

from modeling_base import *
from eda import format_nrel_dataframe
from mlp_base import *

if __name__ == "__main__":

    df = format_nrel_dataframe("../../data/2003_2016.csv")
    lag_features = [
        'Temperature', 'Clearsky DHI', 'Clearsky DNI', 'Clearsky GHI',
        'Cloud Type', 'Dew Point', 'DHI', 'DNI', 'Fill Flag', 'GHI',
        'Relative Humidity', 'Solar Zenith Angle', 'Surface Albedo',
        'Pressure', 'Precipitable Water', 'Wind Direction', 'Wind Speed'
    ]
    df = create_lagged_features(df, lag_features, 4, 30)
    df = create_future_target(df, 'DNI', 1, 30)

    mlp = build_neural_network(len(df.columns) - 3, [10, 40])

    same_week_results = {}
    for i in range(1, 6):
        key = f"{i}_week_same_mlp_results"
        mlp_error_dict = iterative_nn_testing(mlp,
                                              df,
                                              'DNI_T_plus30',