Changeset 3313 for trunk/urbansim/estimation/estimator.py
- Timestamp:
- 05/08/08 16:00:09 (3 months ago)
- Files:
-
- 1 modified
-
trunk/urbansim/estimation/estimator.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/urbansim/estimation/estimator.py
r3310 r3313 155 155 new_choices = agents.get_attribute(choice_id_name).copy() 156 156 agents.modify_attribute(name=choice_id_name, data=current_choices) 157 agents.add_primary_attribute(name=predicted_choice_id_name, data=new_choices) 157 if predicted_choice_id_name not in agents.get_known_attribute_names(): 158 agents.add_primary_attribute(name=predicted_choice_id_name, data=new_choices) 159 else: 160 agents.modify_attribute(name=predicted_choice_id_name, data=new_choices) 158 161 logger.log_status("Predictions saved into attribute " + predicted_choice_id_name) 159 162 return True … … 168 171 predicted_choice_id_prefix="predicted_", 169 172 predicted_choice_id_name=None, 170 log_to_file=None): 173 log_to_file=None, 174 force_predict=True): 171 175 agents = self.get_agent_set() 172 176 choices = self.get_choice_set() … … 175 179 predicted_choice_id_name = predicted_choice_id_prefix + choice_id_name 176 180 177 if not predicted_choice_id_name in agents.get_known_attribute_names():181 if force_predict or (predicted_choice_id_name not in agents.get_known_attribute_names()): 178 182 if not self.predict(predicted_choice_id_prefix=predicted_choice_id_prefix, 179 183 predicted_choice_id_name=predicted_choice_id_name):
