Skip to content

Commit

Permalink
reset the MSM default parameter (cost c) to 1 rather than 0
Browse files Browse the repository at this point in the history
  • Loading branch information
TonyBagnall committed Feb 17, 2021
1 parent cef586e commit 0cdf9a1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
15 changes: 7 additions & 8 deletions sktime/contrib/experiments.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@ def set_classifier(cls, resampleId=None):
elif name == "ps" or name == "proximityStump":
return ProximityStump(random_state=resampleId)
elif name == "dtwcv" or name == "kneighborstimeseriesclassifier":
return KNeighborsTimeSeriesClassifier(metric="dtwcv")
elif name == "dtw" or name == "1nn-dtw":
return KNeighborsTimeSeriesClassifier(metric="dtw")
elif name == "msm" or name == "1nn-msm":
return KNeighborsTimeSeriesClassifier(metric="msm")
elif name == "ee" or name == "elasticensemble":
return ElasticEnsemble()
elif name == "shapedtw":
Expand Down Expand Up @@ -575,18 +579,13 @@ def test_loading():
train_file=tf,
)
else: # Local run
# data_dir = "/scratch/univariate_datasets/"
# results_dir = "/scratch/results"
# data_dir = "/bench/datasets/Univariate2018/"
# results_dir = "C:/Users/ajb/Dropbox/Turing Project/Results/"
print(" Local Run")
data_dir = "C:/Code/sktime/sktime/datasets/data/"
data_dir = "Z:/ArchiveData/Univariate_ts/"
results_dir = "C:/Temp/"
# results_dir = "Z:/Results/sktime Bakeoff/"
dataset = "UnitTest"
dataset = "ArrowHead"
trainX, trainY = load_ts(data_dir + dataset + "/" + dataset + "_TRAIN.ts")
testX, testY = load_ts(data_dir + dataset + "/" + dataset + "_TEST.ts")
classifier = "KNeighborsTimeSeriesClassifier"
classifier = "1NN-MSM"
resample = 0
# for i in range(0, len(univariate_datasets)):
# dataset = univariate_datasets[i]
Expand Down
3 changes: 1 addition & 2 deletions sktime/distances/elastic.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,7 @@ def msm_single_channel(first, second, **kwargs) -> float:
try:
c = kwargs["c"]
except KeyError:
c = 0.1

c = 1
m = len(first)
n = len(second)

Expand Down
3 changes: 1 addition & 2 deletions sktime/distances/elastic_cython.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,11 @@ def wddtw_distance(np.ndarray[double, ndim=2] x, np.ndarray[double, ndim=2] y ,
return wdtw_distance(np.diff(x.T).T,np.diff(y.T).T,g)


def msm_distance(np.ndarray[double, ndim=2] x, np.ndarray[double, ndim=2] y, double c = 0, int dim_to_use = 0):
def msm_distance(np.ndarray[double, ndim=2] x, np.ndarray[double, ndim=2] y, double c = 1, int dim_to_use = 0):

cdef np.ndarray[double, ndim=2] first = x
cdef np.ndarray[double, ndim=2] second = y
cdef np.ndarray[double, ndim=2] temp

if len(first) > len(second):
temp = first
first = second
Expand Down

0 comments on commit 0cdf9a1

Please sign in to comment.