# generating destroyed measurements which are constant over all
# methods

data = []

for park in parks.keys():
    windpark = NREL().get_windpark_nearest(parks[park], 5, 2004)
    windpark_test = NREL().get_windpark_nearest(parks[park], 5, 2005)

    target = windpark.get_target()
    measurements = repair_nrel(target.get_measurements()[:10000])

    for i in range(2):

        damaged_series = {}
        de = lambda rate: (rate, (destroy(
            measurements, method=destroy_method, percentage=rate)[0]))

        dseries = map(de, rates)
        for rate, series in dseries:
            damaged_series[rate] = series

        # with reconstruction

        def run(pars):
            method, rate = pars
            mse = experiment(method, windpark, windpark_test,
                             damaged_series[rate], rate)
            return method, rate, mse

        results = map(run, list(chain(product(methods, rates))))
Ejemplo n.º 2
0
    error, var, std = scores(measurements, reconstructed)
    return error, var, std

# generating destroyed measurements which are constant over all
# methods

data = []

park = 'reno'
windpark = NREL().get_windpark_nearest(parks[park], 5, 2004)
target = windpark.get_target()
measurements = repair_nrel(target.get_measurements()[:10000])

for i in range(2):
    damaged_series = {}
    de = lambda rate : (rate, (destroy(measurements, method=destroy_method, percentage=rate)[0]))

    dseries = map(de, rates)
    for rate, series in dseries:
        damaged_series[rate] = series

    def run(pars):
        method, rate = pars
        error, var, std = experiment(method, windpark, damaged_series[rate], rate)
        return method, rate, error, var, std

    results = map(run, list(chain(product(methods, rates))))
    encoding = lambda method, rate, error, park, var, std :\
        {"method": method,\
        "rate": rate,\
        "rmse": error,\
Ejemplo n.º 3
0
from windml.preprocessing.preprocessing import interpolate
from windml.visualization.plot_timeseries import plot_timeseries

import matplotlib.pyplot as plt
import matplotlib.dates as md
from pylab import *

from numpy import array, zeros, float32, int32

# get windpark and corresponding target. forecast is for the target turbine
park_id = NREL.park_id['tehachapi']
windpark = NREL().get_windpark(park_id, 3, 2004)
target = windpark.get_target()

measurements = target.get_measurements()[300:1000]
damaged, indices = destroy(measurements, method="nmar", percentage=.80,\
        min_length=10, max_length=100)

neighbors = windpark.get_turbines()[:-1]
nseries = [t.get_measurements()[300:1000] for t in neighbors]

tinterpolated = interpolate(damaged, method='mreg',\
                            timestep=600,\
                            neighbor_series = nseries,\
                            reg = 'linear_model')

d = array([m[0] for m in tinterpolated])
y1 = array([m[1] for m in tinterpolated]) #score
y2 = array([m[2] for m in tinterpolated]) #speed

d_hat = array([m[0] for m in damaged])
y1_hat = array([m[1] for m in damaged])
Ejemplo n.º 4
0
from sklearn.model_selection import GridSearchCV
from sklearn.model_selection import KFold

import matplotlib.pyplot as plt
import matplotlib.dates as md
from pylab import *

from numpy import array, zeros, float32, int32

# get windpark and corresponding target. forecast is for the target turbine
park_id = NREL.park_id['tehachapi']
windpark = NREL().get_windpark(park_id, 5, 2004)
target = windpark.get_target()

measurements = target.get_measurements()[300:1000]
damaged, indices = destroy(measurements, method='nmar', percentage=.80,\
        min_length=10, max_length=100)

neighbors = windpark.get_turbines()[:-1]
nseries = [t.get_measurements()[300:1000] for t in neighbors]

gamma_range = [0.0001, 0.000001]
C_range = [2**i for i in range(-3, 5, 1)]
regargs = {
    "epsilon": 0.1,
    "cv_method": "kfold",
    "cv_args": {
        "k_folds": 10
    },
    "kernel": 'rbf',
    "tuned_parameters": [{
        'kernel': ['rbf'],
Ejemplo n.º 5
0
# License: BSD 3 clause

from windml.datasets.nrel import NREL
from windml.visualization.plot_timeseries import plot_timeseries
from windml.preprocessing.preprocessing import destroy

import matplotlib.pyplot as plt
import matplotlib.dates as md
from pylab import *

from numpy import array

ds = NREL()
turbine = ds.get_turbine(NREL.park_id['tehachapi'], 2004)
measurements = turbine.get_measurements()[:1000]
damaged, indices = destroy(measurements, method='mar', percentage=.80)

d = array([m[0] for m in measurements])
y1 = array([m[1] for m in measurements]) #score
y2 = array([m[2] for m in measurements]) #speed

d_hat = array([m[0] for m in damaged])
y1_hat = array([m[1] for m in damaged])
y2_hat = array([m[2] for m in damaged])

d_time = []
for i in range (len(d)):
    d_act = datetime.datetime.fromtimestamp(d[i])
    d_time.append(d_act)

d_time_hat = []
Ejemplo n.º 6
0
# License: BSD 3 clause

from windml.datasets.nrel import NREL
from windml.visualization.plot_timeseries import plot_timeseries
from windml.preprocessing.preprocessing import destroy

import matplotlib.pyplot as plt
import matplotlib.dates as md
from pylab import *

from numpy import array

ds = NREL()
turbine = ds.get_turbine(NREL.park_id['tehachapi'], 2004)
measurements = turbine.get_measurements()[:1000]
damaged, indices = destroy(measurements, method='mar', percentage=.80)

d = array([m[0] for m in measurements])
y1 = array([m[1] for m in measurements])  #score
y2 = array([m[2] for m in measurements])  #speed

d_hat = array([m[0] for m in damaged])
y1_hat = array([m[1] for m in damaged])
y2_hat = array([m[2] for m in damaged])

d_time = []
for i in range(len(d)):
    d_act = datetime.datetime.fromtimestamp(d[i])
    d_time.append(d_act)

d_time_hat = []