def project_single_event(self, event_to_project, X_fields): ''' uses numpy to predict a single event ''' # this is easy to do with pdfs, but just to make sure we have everything correct, we'll do everything out # turn the event into a numpy array x, y = sm.event_to_numpy_reps_continuous_continuous(event_to_project, self.feature_mapping, X_fields[0]) #x_fields[0] to throw away # projection defined as x dot self.components (1x45 * 45x4 -> 1x4) return np.dot(x, self.components)
def predict_single_event(self, event_to_predict, X_fields, Y_field): ''' uses numpy to predict a single event ''' # this is easy to do with pdfs, but just to make sure we have everything correct, we'll do everything out # turn the event into a numpy array x, y = sm.event_to_numpy_reps_continuous_continuous(event_to_predict, self.feature_mapping, Y_field, bias=True) # h(x) defined as theta^T x h_x = np.dot(self.theta.T, x) return h_x
def predict_single_event(self, event_to_predict, X_fields, Y_field): ''' uses numpy to predict a single event ''' # this is easy to do with pdfs, but just to make sure we have everything correct, we'll do everything out # turn the event into a numpy array x, y = sm.event_to_numpy_reps_continuous_continuous( event_to_predict, self.feature_mapping, Y_field, bias=True) # h(x) defined as theta^T x h_x = np.dot(self.theta.T, x) return h_x