Hi Katie. Thanks a lot for your kind lectures. I have a question about the 'set' in .dat file. In your case, 'month' is simple which is sort of a list just including 5 elements. But how about I tend to use/introduce timeindex (e.g., Pandaframe index) values to be a set variable 'time'? It could be very long since there will be 1440 elements if the time interval is one minute for one day (24*60). how could I realize that? do I need to type them into a .dat file manually?
I would recommend within your model file using a range set. So you could do something like: model.MONTHS = RangeSet(1,timeindex.length(),1) This would create a set with the numbers 1 through the length of the number of elements in your panda data frame, then just leave the set definition out of the data file.
Hi James! Making those syntax mistakes and fixing them is part of the learning process. If you ever get too stuck just reach out and I'd be happy to help.
Content like this is highly appreciated. Thank You, Professor Katie. I am trying to reproduce the same and With data=DataPortal() data.load(filename='abstractmodelcreation.dat', model=model) instance = model.create_instance(data) the error is: AttributeError: 'DataPortal' object has no attribute 'is_constructed' while with, data=DataPortal() data.load(filename='abstractmodelcreation.dat', set=model.MONTHS) instance = model.create_instance(data) the error is ValueError: Parameter 'salaryExp' defined with '1' dimensions, but data has '1' values: [2000]. Are you missing a value for a 1-dimensional index?
Errors in these models can be finicky and hard to find. The error messages are often not particularly helpful either. Check the parameter for salaryExp matches in both your model and data file. Make sure salaryExp has no sets listed in its declaration. Finally, I’d be happy to take a look at your files if you use Google colab and share them with me.
All set! You were missing the () after model = AbstractModel, is should say model=AbstractModel(). Assuming your data file is correct (I had to use my own), everything will work fine once you add in those (). If it doesn't work, take a look at your data file.
Very helpful, thank you so much!
Just what I've been looking for. This is awesome. Thanks
Thank you for this video! It really helps!
Thank you Dr. Katie. You're the best.
Thank you for this Dr. Katie. Maximally helpful.
Can you use this approach when your source file is .xlsx so excel files?
Hi Katie. Thanks a lot for your kind lectures. I have a question about the 'set' in .dat file. In your case, 'month' is simple which is sort of a list just including 5 elements. But how about I tend to use/introduce timeindex (e.g., Pandaframe index) values to be a set variable 'time'? It could be very long since there will be 1440 elements if the time interval is one minute for one day (24*60). how could I realize that? do I need to type them into a .dat file manually?
I would recommend within your model file using a range set. So you could do something like: model.MONTHS = RangeSet(1,timeindex.length(),1) This would create a set with the numbers 1 through the length of the number of elements in your panda data frame, then just leave the set definition out of the data file.
This is beautiful. Any chance a copy of the files can be provided as it just shortens definition time and avoids syntax errors
Hi James! Making those syntax mistakes and fixing them is part of the learning process. If you ever get too stuck just reach out and I'd be happy to help.
Content like this is highly appreciated. Thank You, Professor Katie.
I am trying to reproduce the same and
With
data=DataPortal()
data.load(filename='abstractmodelcreation.dat', model=model)
instance = model.create_instance(data)
the error is:
AttributeError: 'DataPortal' object has no attribute 'is_constructed'
while with,
data=DataPortal()
data.load(filename='abstractmodelcreation.dat', set=model.MONTHS)
instance = model.create_instance(data)
the error is
ValueError: Parameter 'salaryExp' defined with '1' dimensions, but data has '1' values: [2000]. Are you missing a value for a 1-dimensional index?
Errors in these models can be finicky and hard to find. The error messages are often not particularly helpful either. Check the parameter for salaryExp matches in both your model and data file. Make sure salaryExp has no sets listed in its declaration. Finally, I’d be happy to take a look at your files if you use Google colab and share them with me.
All set! You were missing the () after model = AbstractModel, is should say model=AbstractModel(). Assuming your data file is correct (I had to use my own), everything will work fine once you add in those (). If it doesn't work, take a look at your data file.
@@DrKatieRIT I really appreciate your prompt solution. Yeah, it is working now. You are awesome.