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
from collections import defaultdict | |
import numpy as np | |
import pandas as pd | |
from rich.console import Console | |
from rich.table import Table | |
import torch | |
import torch.nn as nn |
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
# coding=utf-8 | |
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software |
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 tensorflow as tf | |
import torch | |
from torchmetrics import Metric | |
def tf2pt(x_tf=None): | |
if x_tf is None: | |
return 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
from sklearn.datasets import load_boston | |
from sklearn.linear_model import (LinearRegression, Ridge, SGDRegressor, | |
Lasso, ElasticNetCV) | |
from sklearn.preprocessing import MinMaxScaler | |
import numpy as np | |
#from minepy import MINE | |
from sklearn.metrics import mean_squared_error | |
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
from sklearn.datasets import load_boston | |
from sklearn.linear_model import (LinearRegression, Ridge, LassoCV, ElasticNetCV, | |
ElasticNet, Lasso, RandomizedLasso) | |
from sklearn.feature_selection import RFE, f_regression | |
from sklearn.preprocessing import MinMaxScaler | |
from sklearn.ensemble import RandomForestRegressor, GradientBoostingRegressor | |
import numpy as np | |
import pdb | |
#from minepy import MINE |
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
from sklearn.datasets import load_boston | |
from sklearn.linear_model import (LinearRegression, Ridge, | |
Lasso, RandomizedLasso) | |
from sklearn.feature_selection import RFE, f_regression | |
from sklearn.preprocessing import MinMaxScaler | |
from sklearn.ensemble import RandomForestRegressor, GradientBoostingRegressor | |
import numpy as np | |
#from minepy import MINE | |
from sklearn.metrics import mean_squared_error |
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 torch | |
import torch.nn as nn | |
class EvoNorm2d(nn.Module): | |
__constants__ = ['num_features', 'eps', 'nonlinearity'] | |
def __init__(self, num_features, eps=1e-5, nonlinearity=True): | |
super(EvoNorm2d, self).__init__() | |
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
def input_fn(file_pattern, labels, | |
image_size=(224,224), | |
shuffle=False, | |
batch_size=64, | |
num_epochs=None, | |
buffer_size=4096, | |
prefetch_buffer_size=None): | |
table = tf.contrib.lookup.index_table_from_tensor(mapping=tf.constant(labels)) | |
num_classes = len(labels) |
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
class AccSGD(Optimizer): | |
"""AccSGD optimizer. | |
Arguments: | |
lr (float): learning rate | |
kappa (float, optional): ratio of long to short step (default: 1000) | |
xi (float, optional): statistical advantage parameter (default: 10) | |
smallConst (float, optional): any value <=1 (default: 0.7) | |
# References |
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
class AMSgrad(Optimizer): | |
"""AMSGrad optimizer. | |
Default parameters follow those provided in the Adam paper. | |
# Arguments | |
lr: float >= 0. Learning rate. | |
beta_1: float, 0 < beta < 1. Generally close to 1. | |
beta_2: float, 0 < beta < 1. Generally close to 1. | |
epsilon: float >= 0. Fuzz factor. |
NewerOlder