コード例 #1
0

args = parse_args()
np.random.seed(args.seed)

prob_args = {
    "prob_name": args.prob_name,
    "base_path": args.base_path,
    "return_d3mds": True,
    "use_schema": args.use_schema,
    "strict": True,
}

t = time()

train, test = uv_load(args.base_path, args.prob_name)

import numpy as np
from sklearn.decomposition import PCA


def tss_to_numpy(bag=''):
    keys = list(bag.keys())

    remove = ['Type', 'Samples', 'Size', 'Labels']

    [keys.remove(r) for r in remove]

    return np.vstack([bag[i].data for i in keys])

コード例 #2
0
from src.timeseries.TimeSeriesLoader import uv_load
from  src.transformation.SFA import *

symbols = 8
wordLength = 16
normMean = False

def sfaToWord(word):
    word_string = ""
    alphabet = "abcdefghijklmnopqrstuv"
    for w in word:
        word_string += alphabet[w]
    return word_string


train, test = uv_load("Gun_Point")

sfa = SFA("EQUI_DEPTH")

sfa.fitTransform(train, wordLength, symbols, normMean)

sfa.printBins()

for i in range(test["Samples"]):
    wordList = sfa.transform2(test[i].data, "null")
    print(str(i) + "-th transformed time series SFA word " + "\t" + sfaToWord(wordList))




コード例 #3
0
ファイル: SFA.py プロジェクト: zwbjtu123/Mr-SEQL
 def __init__(self, ucr_data):
     self.sfa = {}
     self.train, self.test = uv_load(ucr_data)  # store train data only
コード例 #4
0
from src.classification.WEASELClassifier import *
from src.classification.BOSSEnsembleClassifier import *
from src.classification.BOSSVSClassifier import *
from src.classification.ShotgunEnsembleClassifier import *
from src.classification.ShotgunClassifier import *

Datasets = [  #"Coffee",
    # "Beef",
    # "ECG200",
    "Gun_Point",
    # "BeetleFly"
]

for data in Datasets:
    train, test = uv_load(data)

    #The WEASEL Classifier
    weasel = WEASELClassifier(data)
    scoreWEASEL = weasel.eval(train, test)[0]
    print(data + "; " + scoreWEASEL)

    #The BOSS Ensemble Classifier
    boss = BOSSEnsembleClassifier(data)
    scoreBOSS = boss.eval(train, test)[0]
    print(data + "; " + scoreBOSS)

    #The BOSS VS Classifier
    bossVS = BOSSVSClassifier(data)
    scoreBOSSVS = bossVS.eval(train, test)[0]
    print(data + "; " + scoreBOSSVS)
コード例 #5
0
from src.timeseries.TimeSeriesLoader import uv_load
from src.timeseries.TimeSeriesLoader import mv_load
from src.utils import logger
import src.utils.parameters as params

FIXED_PARAMETERS = params.load_parameters()
logpath = FIXED_PARAMETERS["log_path"] + FIXED_PARAMETERS[
    'test'] + "_" + FIXED_PARAMETERS['dataset'] + ".log"
logger = logger.Logger(logpath)
logger.Log("FIXED_PARAMETERS\n %s" % FIXED_PARAMETERS)

try:
    train, test = uv_load(FIXED_PARAMETERS['dataset'], logger=logger)
except:
    train, test = mv_load(FIXED_PARAMETERS['dataset'],
                          useDerivatives=True,
                          logger=logger)

try:
    ##=========================================================================================
    ## Multivariate Classifier Tests
    ##=========================================================================================
    if FIXED_PARAMETERS['test'] == 'MUSE':
        logger.Log("Test: MUSE")
        from src.classification.MUSEClassifier import *
        muse = MUSEClassifier(FIXED_PARAMETERS, logger)
        scoreMUSE = muse.eval(train, test)[0]
        logger.Log("%s: %s" % (FIXED_PARAMETERS['dataset'], scoreMUSE))

    ##=========================================================================================
    ## Univariate Classifier Tests