KANModel
- class mastml.models.KANModel(width, grid=3, k=3, steps=20, seed=None, savepath=None, opt='LBFGS', lamb=0.01, lamb_entropy=10)[source]
Bases:
KAN- Implementation of Kolmogorov-Arnold Networks (KANs) from the following work:
Liu, Z., Wang, Y., Vaidya, S., Ruehle, F. Halverson, J., Soljacic, M. Hou, T. Y., Tegmark, M. “KAN: Kolmogorov-Arnold Networks”, arXiv (2024) (https://arxiv.org/abs/2404.19756)
Information on input parameters taken from pykan Github: https://github.com/KindXiaoming/pykan
- Args:
- width (list of int): list of integers specifying the network architecture. For regression problems, the first number is
equal to the number of input features, the last number is the output number of nodes (= 1), and the intermediate numbers determine the number of nodes in hidden layers. Default is N - 2N+1 - 1 following the KA theorem, where N = number of input features
grid (int): The number of grid intervals
k (int): The order of piecewise polynomial
steps (int): Number of KAN training steps. Similar to epochs for MLPs
seed (int): the input seed. Defaults to 0 so need to set new seed for each split to have random start
savepath (str): path to save the output model
opt (str): optimization method. Possibilities include “LBFGS”, or “Adam”
lamb (float): overall penalty strength
lamb_entropy (float): entropy penalty strength
Methods:
- fit: method that fits the model parameters to the provided training data
- Args:
X: (pd.DataFrame), dataframe of X data used for model training
y: (pd.Series), series of y target data
- Returns:
fitted model
- predict: method that evaluates model on new data to give predictions
- Args:
X: (pd.DataFrame), dataframe of X data used for model testing
as_frame: (bool), whether to return data as pandas dataframe (else numpy array)
- Returns:
series or array of predicted values
Methods Summary
fit(X, y)predict(X[, as_frame])Methods Documentation