Skip to content

Commit

Permalink
Update models.py
Browse files Browse the repository at this point in the history
  • Loading branch information
xin-huang committed Sep 26, 2023
1 parent 7a1a1f4 commit 64e2c39
Showing 1 changed file with 35 additions and 18 deletions.
53 changes: 35 additions & 18 deletions sstar/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,36 +17,53 @@
import statsmodels.api as sm
import statsmodels.formula.api as smf
import numpy as np
from abc import ABC, abstractmethod


def train_logistic_regression(train_df, model_file):
class Model(ABC):
"""
Description:
Function for training of the statsmodels logistic classification.
Arguments:
train_df pandas.DataFrame: Training data
save_filename str: filename for output model
"""
sm_data_exog = train_df.copy()
sm_data_exog.drop(['label'], axis=1, inplace=True)
sm_data_exog = sm.add_constant(sm_data_exog, prepend=False)
@abstractmethod
def train(self):
pass


@abstractmethod
def infer(self):
pass

sm_data_endog = train_df['label']

glm_binom = sm.GLM(sm_data_endog.astype(int), sm_data_exog.astype(float),family=sm.families.Binomial())
result = glm_binom.fit()
class LogisticRegression(Model):
"""
"""
def train():
"""
Description:
Function for training of the statsmodels logistic classification.
result.save(model_file)
Arguments:
train_df pandas.DataFrame: Training data
save_filename str: filename for output model
"""
sm_data_exog = train_df.copy()
sm_data_exog.drop(['label'], axis=1, inplace=True)
sm_data_exog = sm.add_constant(sm_data_exog, prepend=False)

sm_data_endog = train_df['label']

def infer_logistic_regression(test_df, model_file, output_file):
pass
glm_binom = sm.GLM(sm_data_endog.astype(int), sm_data_exog.astype(float),family=sm.families.Binomial())
result = glm_binom.fit()

result.save(model_file)

def train_sstar():

class ExtraTrees(Model):
"""
"""
pass


def train_extra_trees():
class Sstar(Model):
"""
"""
pass

0 comments on commit 64e2c39

Please sign in to comment.