コード例 #1
0
ファイル: handle_WordSet.py プロジェクト: rickpaul/becon-0.1
		def fdel(self):
			log.info('WORDSET: Removing Predictive Words')
			keys = [word_key(w) for w in self._pred_words]
			log.info('WORDSET: Removing Response Prediction Words (because Predictors are Removed)')
			keys += [prd_word_key(w) for w in self._resp_words]
			for key_ in keys:
				self.delete_column(key_, expect_metadata=False)
			del self._pred_words
コード例 #2
0
ファイル: handle_WordSet.py プロジェクト: rickpaul/becon-0.1
		def fdel(self):
			log.info('WORDSET: Removing Response Words')
			keys = [word_key(w) for w in self._resp_words]
			keys += [raw_word_key(w) for w in self._resp_words]
			keys += [prd_word_key(w) for w in self._resp_words]
			del self._resp_words
			for key_ in keys:
				self.delete_column(key_, expect_metadata=False)
コード例 #3
0
ファイル: handle_WordSet.py プロジェクト: rickpaul/becon-0.1
	def get_residual_data(self, hndl_Word):
		raw_key = raw_word_key(hndl_Word)
		prd_key = prd_word_key(hndl_Word)
		prd_ = self.get_series_by_col(prd_key, filter_nulls=False)
		raw_ = self.get_series_by_col(raw_key, filter_nulls=False)
		residuals = prd_ - raw_
		filter_ = ~residuals.isnull()
		smoothed = savitzky_golay(np.array(prd_[filter_]))
		return (smoothed, prd_[filter_], raw_[filter_], residuals[filter_])
コード例 #4
0
ファイル: handle_WordSet.py プロジェクト: rickpaul/becon-0.1
	def plot_values(self, hndl_Word):
		'''
		Plot the raw data, predicted data, and smoothed data
		(For testing)
		'''
		from util_Testing import plot_data_series
		from handle_TestSeries import EMF_TestSeries_Handle
		raw_key = raw_word_key(hndl_Word)
		prd_key = prd_word_key(hndl_Word)
		raw = EMF_TestSeries_Handle()
		(raw.dates, raw.values) = self.get_values_by_col(raw_key, filter_nulls=True)
		prd = EMF_TestSeries_Handle()
		(prd.dates, prd.values) = self.get_values_by_col(prd_key, filter_nulls=True)
		smooth = EMF_TestSeries_Handle()
		smooth.values = savitzky_golay(np.array(prd.values))
		smooth.dates = prd.dates
		plot_data_series(raw, prd, smooth)
コード例 #5
0
ファイル: handle_WordSet.py プロジェクト: rickpaul/becon-0.1
	def save_predictions(self, hndl_Model, hndl_Word):
		'''
		Create the model predictions and store them in the array.
		'''
		if hndl_Word.prediction_requires_raw_data():
			filter_ = self.get_model_filter(mode=PREDICTION_DEPENDENT)
			raw_key = raw_word_key(hndl_Word)
			raw_data = np.array(self.col_array[raw_key][filter_]).reshape(-1)
			raw_predictions = hndl_Model.model.predict(self.get_word_arrays(mode=PREDICTION_DEPENDENT)[0])
		else:
			filter_ = self.get_model_filter(mode=PREDICTION_INDEPENDENT)
			raw_data = None
			raw_predictions = hndl_Model.model.predict(self.get_word_arrays(mode=PREDICTION_INDEPENDENT)[0])
		values = hndl_Word.hndl_Trns.reverse_transform_data(raw_data, raw_predictions)
		dates = self.find_prediction_dates(hndl_Word)
		prd_key = prd_word_key(hndl_Word)
		self.add_column(dates, values, key=prd_key, force=True)
コード例 #6
0
ファイル: handle_WordSet.py プロジェクト: rickpaul/becon-0.1
	def get_prediction_series(self, hndl_Word):
		prd_key = prd_word_key(hndl_Word)
		return self.get_values_by_col(prd_key, filter_nulls=True)