Source code for pyFTS.common.Activations
"""
Activation functions for Time Series Classification
"""
import numpy as np
import math
from pyFTS import *
[docs]def scale(dist : dict) -> dict:
norm = np.sum([v for v in dist.values()])
return {k : (v / norm) for k,v in dist.items() }
[docs]def softmax(dist : dict) -> dict:
norm = np.sum([np.exp(v) for v in dist.values()])
return {k : (np.exp(v) / norm) for k,v in dist.items() }
[docs]def argmax(dist : dict) -> str:
mx = np.max([v for v in dist.values()])
return [k for k,v in dist.items() if v == mx ][0]