This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cvxopt | |
import numpy as np | |
from .base import BaseModel | |
class SVMSoftMargin(BaseModel): | |
def __init__(self, C: float): | |
self.C = C |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cvxopt | |
import numpy as np | |
from .base import BaseModel | |
class SVM(BaseModel): | |
def __init__(self): | |
self._w = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def pinv(x: np.ndarray, singular_threshold: float = 1e-10): | |
""" | |
Pseudo inverse.\n | |
Params: | |
x: matrix to inverse | |
singular_threshold: threshold to remove singularvalues | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from .base import BaseModel | |
from .helper import pinv | |
class LinearRegression(BaseModel): | |
def __init__(self): | |
self._beta = None |