MCPcopy Create free account

hub / github.com/aildnont/water-forecast / functions

Functions84 in github.com/aildnont/water-forecast

↓ 5 callersMethodevaluate_forecast
Given ground truth data and forecasts, assess the model's performance by computing using time series regression metrics. Optionally v
src/models/model.py:61
↓ 5 callersMethodmake_windowed_dataset
Make time series datasets. Each example is a window of the last T_x data points and label is data point 1 day into the future.
src/models/nn.py:170
↓ 4 callersMethodmake_windowed_dataset
Make time series datasets. Each example is a window of the last T_x data points and label is data point 1 day into the future.
src/models/skmodels.py:153
↓ 3 callersMethod__init__
(self, hparams, name, log_dir)
src/models/nn.py:22
↓ 3 callersMethodfit
Fits an RNN forecasting model :param dataset: A Pandas DataFrame with feature columns and a Consumption column
src/models/nn.py:45
↓ 3 callersFunctionload_dataset
Load preprocessed dataset and return training and test sets. :param cfg: Project config :return: DataFrames for training and test sets
src/train.py:29
↓ 3 callersFunctionload_raw_data
Load all entries for water consumption and combine into a single dataframe :param cfg: project config :param save_raw_df: Flag indicating
src/data/preprocess.py:9
↓ 3 callersFunctionpreprocess_ts
Transform raw water demand data into a time series dataset ready to be fed into a model. :param cfg: project config :param save_raw_df: F
src/data/preprocess.py:148
↓ 3 callersFunctiontrain_single
Train a single model. Use the passed hyperparameters if possible; otherwise, use those in config. :param cfg: Project config :param hpara
src/train.py:99
↓ 2 callersMethod__init__
(self, hparams, name, log_dir)
src/models/skmodels.py:18
↓ 2 callersFunctioncalculate_ts_data
Calculates estimates for daily water consumption based on provided historical data. Assumes each client consumes water at a uniform rate over
src/data/preprocess.py:74
↓ 2 callersFunctioncluster_clients
Runs k-prototypes clustering algorithm on preprocessed dataset :param k: Desired number of clusters :param save_centroids: Boolean indica
src/data/kprototypes.py:14
↓ 2 callersFunctioncross_validation
Perform a nested cross-validation with day-forward chaining. Results are saved in CSV format. :param cfg: project config :param dataset:
src/train.py:153
↓ 2 callersMethodevaluate
Evaluates performance of RNN model on test set :param train_set: A Pandas DataFrame with feature columns and a Consumption column
src/models/nn.py:77
↓ 2 callersMethodfit
Fits an RNN forecasting model :param dataset: A Pandas DataFrame with feature columns and a Consumption column
src/models/skmodels.py:35
↓ 2 callersFunctionforecast
Generate a forecast for a certain number of days :param days: Length of forecast :param cfg: Project config :param model: Model objec
src/predict.py:25
↓ 2 callersMethodforecast
Create a forecast for the test set. Note that this is different than obtaining predictions for the test set. The model makes a predic
src/models/nn.py:122
↓ 2 callersFunctionplot_prophet_forecast
Plot Prophet model's forecast using the Prophet API, including changepoints :param prophet_model: Fitted Prophet model :param prophet_pre
src/visualization/visualize.py:299
↓ 2 callersFunctiontrain_model
Train a model :param cfg: Project config :param model_def: Class definition of model to train :param hparams: A dict of hyperparamete
src/train.py:58
↓ 1 callersFunctionbayesian_hparam_optimization
Conducts a Bayesian hyperparameter optimization, given the parameter ranges and selected model :param cfg: Project config :return: Dict o
src/train.py:219
↓ 1 callersFunctionclient_box_plot
Produces a box plot for all features in the dataset :param client_df: A DataFrame indexed by client identifier :param save_fig: Flag indi
src/visualization/visualize.py:121
↓ 1 callersFunctioncorrelation_matrix
Produces a correlation matrix for a dataset :param dataset: A DataFrame :save_fig: Flag indicating whether to save the figure
src/visualization/visualize.py:101
↓ 1 callersFunctiondaily_consumption
(cons, start_date, end_date)
src/data/preprocess.py:112
↓ 1 callersMethoddecompose
Decompose model into its trend, holiday, weekly and yearly components. Generate a plot and save parameters. Creates a new directory w
src/models/prophet.py:117
↓ 1 callersMethoddefine_model
Abstract method for TensorFlow model definition
src/models/nn.py:38
↓ 1 callersMethoddefine_model
Abstract method for TensorFlow model definition
src/models/skmodels.py:28
↓ 1 callersMethodforecast
Create a forecast for the test set. Note that this is different than obtaining predictions for the test set. The model makes a predic
src/models/arima.py:64
↓ 1 callersMethodforecast
Create a forecast for the test set. Note that this is different than obtaining predictions for the test set. The model makes a predic
src/models/sarimax.py:72
↓ 1 callersMethodforecast
Create a forecast for the test set. Note that this is different than obtaining predictions for the test set. The model makes a predic
src/models/skmodels.py:102
↓ 1 callersMethodget_recent_data
Given a preprocessed dataset, get the most recent factual example :param dataset: A DataFrame representing a preprocessed dataset
src/models/nn.py:186
↓ 1 callersMethodload
Loads the model from disk :param model_path: Path to saved model
src/models/nn.py:156
↓ 1 callersFunctionmerge_raw_data
Loads all raw water demand CSVs available and merges it into one dataset, keeping the latest consumption records for each client if readings
src/data/preprocess.py:211
↓ 1 callersFunctionplot_bayesian_hparam_opt
Plot all 2D hyperparameter comparisons from the logs of a Bayesian hyperparameter optimization. :param model_name: Name of the model :par
src/visualization/visualize.py:242
↓ 1 callersFunctionplot_model_evaluation
Plot model's predictions on training and test sets, along with key performance metrics. :param forecast_df: DataFrame consisting of predicted
src/visualization/visualize.py:48
↓ 1 callersFunctionplot_prophet_components
Plot Prophet model's forecast components. This plot visualizes trend, yearly seasonality, weekly seasonality, holiday effects :param prop
src/visualization/visualize.py:281
↓ 1 callersFunctionprepare_for_clustering
Create a DataFrame, indexed by client, that contains client attributes as of a given date. Computes clients' monthly consumption over the las
src/data/preprocess.py:245
↓ 1 callersFunctionpreprocess_new_data
Preprocess a new raw data file and merge it with preexisting preprocessed data. :param cfg: Project config :param save_df: Flag indicatin
src/data/preprocess.py:174
↓ 1 callersMethodsave
Saves the model to disk :param save_dir: Directory in which to save the model
src/models/nn.py:145
↓ 1 callersFunctionsilhouette_analysis
Perform Silhouette Analysis to determine the optimal value for k. For each value of k, run k-prototypes and calculate the average Silhouette
src/data/kprototypes.py:105
↓ 1 callersFunctiontrain_all
Train all models that have available definitions in this project :param cfg: Project config :param save_models: Flag indicating whether t
src/train.py:121
↓ 1 callersFunctiontrain_experiment
Run a training experiment :param cfg: Project config :param experiment: String defining which experiment to run :param save_model: Fl
src/train.py:290
↓ 1 callersFunctionvisualize_client_dataset_stats
Obtain general statistics for features in the client dataset and create a summary figure :param client_df: A DataFrame indexed by client iden
src/visualization/visualize.py:175
↓ 1 callersFunctionvisualize_silhouette_plot
Plot average silhouette score for all samples at different values of k. Use this to determine optimal number of clusters (k). The optimal k i
src/visualization/visualize.py:18
Method__init__
(self, hparams, log_dir=None)
src/models/nn.py:205
Method__init__
(self, hparams, log_dir=None)
src/models/nn.py:239
Method__init__
(self, hparams, log_dir=None)
src/models/nn.py:272
Method__init__
(self, hparams, log_dir=None)
src/models/arima.py:11
Method__init__
(self, hparams, log_dir=None)
src/models/sarimax.py:11
Method__init__
(self, hparams, log_dir=None)
src/models/skmodels.py:190
Method__init__
(self, hparams, log_dir=None)
src/models/skmodels.py:208
Method__init__
(self, hparams, log_dir=None)
src/models/prophet.py:15
Method__init__
(self, model, univariate, name, log_dir=None)
src/models/model.py:15
Functionclient_cmptn_by_rc_violin_plot
Produces a violin plot for consumption by client in the most recent month stratified by rate class :param client_df: A DataFrame indexed by c
src/visualization/visualize.py:155
Methoddefine_model
(self, input_dim)
src/models/nn.py:215
Methoddefine_model
(self, input_dim)
src/models/nn.py:249
Methoddefine_model
(self, input_dim)
src/models/nn.py:286
Methoddefine_model
(self)
src/models/skmodels.py:194
Methoddefine_model
(self)
src/models/skmodels.py:214
Methodevaluate
Evaluates performance of ARIMA model on test set :param train_set: A Pandas DataFrame with 2 columns: Date and Consumption :p
src/models/arima.py:44
Methodevaluate
Evaluates performance of SARIMAX model on test set :param train_set: A Pandas DataFrame with 2 columns: Date and Consumption
src/models/sarimax.py:52
Methodevaluate
Evaluates performance of scikit-learn model on test set :param train_set: A Pandas DataFrame with feature columns and a Consumption c
src/models/skmodels.py:54
Methodevaluate
Evaluates performance of Prophet model on test set :param train_set: A Pandas DataFrame with 2 columns: Date and Consumption
src/models/prophet.py:58
Methodevaluate
Abstract method for model evaluation
src/models/model.py:31
Methodfit
Fits an ARIMA forecasting model :param dataset: A Pandas DataFrame with 2 columns: Date and Consumption
src/models/arima.py:22
Methodfit
Fits a SARIMAX forecasting model :param dataset: A Pandas DataFrame with 2 columns: Date and Consumption
src/models/sarimax.py:26
Methodfit
(self, dataset)
src/models/skmodels.py:197
Methodfit
(self, dataset)
src/models/skmodels.py:217
Methodfit
Fits a Prophet forecasting model :param dataset: A Pandas DataFrame with 2 columns: Date and Consumption
src/models/prophet.py:46
Methodfit
Abstract method for model fitting
src/models/model.py:23
Methodforecast
Create a forecast for the test set. Note that this is different than obtaining predictions for the test set. The model makes a predic
src/models/prophet.py:80
Methodforecast
Abstract method for forecasting with the model
src/models/model.py:39
Methodget_recent_data
Given a preprocessed dataset, get the most recent factual example :param dataset: A DataFrame representing a preprocessed dataset
src/models/skmodels.py:170
Methodload
Loads the model from disk :param model_path: Path to saved model
src/models/arima.py:88
Methodload
Loads the model from disk :param model_path: Path to saved model
src/models/sarimax.py:96
Methodload
Loads the model from disk :param model_path: Path to saved model
src/models/skmodels.py:139
Methodload
Loads the model from disk :param model_path: Path to saved model
src/models/prophet.py:106
Methodload
Abstract method for restoring the model from persistent storage
src/models/model.py:54
Functionobjective
(vals)
src/train.py:256
Functionproduce_data_visualizations
Produces a series of data visualizations for client data and preprocessed consumption data. :param preprocessed_path: Path of preprocessed da
src/visualization/visualize.py:223
Methodsave
Saves the model to disk :param save_dir: Directory in which to save the model
src/models/arima.py:78
Methodsave
Saves the model to disk :param save_dir: Directory in which to save the model
src/models/sarimax.py:86
Methodsave
Saves the model to disk :param save_dir: Directory in which to save the model
src/models/skmodels.py:128
Methodsave
Saves the model to disk :param save_dir: Directory in which to save the model
src/models/prophet.py:96
Methodsave
Abstract method for serializing the model
src/models/model.py:47