kW-Labs / nmecr

An implementation of peer-reviewed energy data analysis algorithms for site-specific M&V
MIT License
24 stars 7 forks source link

5p model getting hug up #23

Open shawk08033 opened 1 year ago

shawk08033 commented 1 year ago

We are having an issue where we are getting back results for every model except the 5p model.

When we run the 5p using the code below and the data frame represented by the attached CSV file, the program gets hung up and no result or error occurs.

Five_P_model <- model_with_CP(training_data = baseline_df, model_input_options = assign_model_inputs(regression_type = "Five Parameter Linear Model"))

Do you have any suggestions?

Thank you for the help.

Shaun nmecrInput.csv

mhsjacoby commented 1 year ago

Hi Shaun,

Thanks for pointing this out. It was indeed getting stuck in an infinite loop. We have modified the code so that it will break out of the loop if it can't fit the 5P model, which will then return an error. In the future we will update the error returned to be more informative. Please update to the latest version (1.0.15) and let us know if you have further issues.

Thanks! Maggie

shawk08033 commented 1 year ago

Maggie,

Thanks for the quick turnaround. It's no longer hanging up anymore but now we get the following error even with data that was returning results with the 5p model perviously.

Error in model_with_CP(training_data = baseline_df, model_input_options = assign_model_inputs(regression_type = "Five Parameter Linear Model")) : object '"Five Parameter Linear Model"' not found Calls: model_with_CP -> -> list2 -> rownames -> Execution halted

Is this a result of the changes just made, or could this be caused by something else?

Thank you,

Shaun

mhsjacoby commented 1 year ago

Hi Shaun,

Can you send the data that you were able to get 5P model results with previously and not anymore?

Thanks, Maggie

shawk08033 commented 1 year ago

Maggie,

She attached. mvinput.csv

Thank you.

mhsjacoby commented 1 year ago

Hi Shaun,

Can you send a script that shows how you’re using the data to build models? It looks like your data is monthly that was expanded to daily, which can sometimes produce unexpected behavior when building daily models.

I’m able to generate a monthly 5P model from your data, but when I run a daily 5P model with the default inputs it returns an error. I can get a daily 5P model when I specify the initial breakpoints - the nmecr defaults don't seem to work with your data (the default breakpoint of 50 is the bottom of your minimum temperature). Here is how I did that:

Five_P_model <- model_with_CP(training_data = baseline_df, model_input_options = assign_model_inputs( regression_type = "Five Parameter Linear Model", initial_breakpoints = c(65,80)))

Look at the assign_model_inputs function for other levers you can use to tune your models.

shawk08033 commented 1 year ago

Maggie,

Yes, the data is monthly data expanded to daily.

Attached is the R Script, far warning it is really complicated because it pulls the data from a text file that we are building in php where our raw data and temperature data are accessible.

We will play around with the breakpoints and see if we can get it work with reasonable numbers.

mvR.txt

Thanks.

shawk08033 commented 1 year ago

Maggie,

On our end, we keep getting this message now when running a 5p model:

Warning message: No breakpoint estimated

We are using the same code and data that you were testing on.