I receive this error when trying to predict off of a model I trained
KeyError: 'Start'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\python\ludwig\venv\Scripts\ludwig-script.py", line 11, in
load_entry_point('ludwig==0.1.0', 'console_scripts', 'ludwig')()
File "D:\python\ludwig\venv\lib\site-packages\ludwig-0.1.0-py3.6.egg\ludwig\cli.py", line 86, in main
File "D:\python\ludwig\venv\lib\site-packages\ludwig-0.1.0-py3.6.egg\ludwig\cli.py", line 64, in __init__
File "D:\python\ludwig\venv\lib\site-packages\ludwig-0.1.0-py3.6.egg\ludwig\cli.py", line 73, in predict
File "D:\python\ludwig\venv\lib\site-packages\ludwig-0.1.0-py3.6.egg\ludwig\predict.py", line 379, in cli
File "D:\python\ludwig\venv\lib\site-packages\ludwig-0.1.0-py3.6.egg\ludwig\predict.py", line 86, in full_predict
File "D:\python\ludwig\venv\lib\site-packages\ludwig-0.1.0-py3.6.egg\ludwig\data\preprocessing.py", line 684, in preprocess_for_prediction
File "D:\python\ludwig\venv\lib\site-packages\ludwig-0.1.0-py3.6.egg\ludwig\data\preprocessing.py", line 61, in build_dataset
File "D:\python\ludwig\venv\lib\site-packages\ludwig-0.1.0-py3.6.egg\ludwig\data\preprocessing.py", line 89, in build_dataset_df
File "D:\python\ludwig\venv\lib\site-packages\ludwig-0.1.0-py3.6.egg\ludwig\data\preprocessing.py", line 152, in build_data
File "D:\python\ludwig\venv\lib\site-packages\ludwig-0.1.0-py3.6.egg\ludwig\data\preprocessing.py", line 173, in handle_missing_values
File "D:\python\ludwig\venv\lib\site-packages\pandascoreframe.py", line 2927, in __getitem__
indexer = self.columns.get_loc(key)
File "D:\python\ludwig\venv\lib\site-packages\pandascore\indexesbase.py", line 2658, in get_loc
return self._engine.get_loc(self._maybe_cast_indexer(key))
File "pandas_libs\index.pyx", line 108, in pandas._libs.index.IndexEngine.get_loc
File "pandas_libs\index.pyx", line 132, in pandas._libs.index.IndexEngine.get_loc
File "pandas_libs\hashtable_class_helper.pxi", line 1601, in pandas._libs.hashtable.PyObjectHashTable.get_item
File "pandas_libs\hashtable_class_helper.pxi", line 1608, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'Start'
@samfultonschool please share the command you used to do the predictions. Also model_definition and the data header would be helpful.
What I imagine the problem is: 'Start' is your target variable and your test data doesn't have it. If that's the case use the flag --only_predictions in your command, which ignores the target variable column.
@msaisumanth Before I was using the command
ludwig predict --data_csv D:\python\test2\practiceBasic.csv --model_path D:\python\ludwig\results\experiment_run_3\model\
Just tried it with --only_predictions and got the same thing.
Just fixed it! Like you said, my test data didn't have 'Start'. I thought it meant something else because the name was Start, I should probably give it a better name next time :). Thank you! @msaisumanth
This look like it was solved :) closing it.
Most helpful comment
@samfultonschool please share the command you used to do the predictions. Also model_definition and the data header would be helpful.
What I imagine the problem is: 'Start' is your target variable and your test data doesn't have it. If that's the case use the flag --only_predictions in your command, which ignores the target variable column.