Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
A Python implementation of GRAIL, a generic framework to learn compact time series representations.
numpy
scipy
tslearn
Installation using pip:
pip install grailts
To install from the source:
python setup.py install
Karhan Kayan (karhan@uchicago.edu)
Here is an example where we load a UCR dataset and run approximate k-nearest neighbors on its GRAIL representations:
from GRAIL.TimeSeries import TimeSeries
from GRAIL.Representation import GRAIL
from GRAIL.kNN import kNN
TRAIN, train_labels = TimeSeries.load("ECG200_TRAIN", "UCR")
TEST, test_labels = TimeSeries.load("ECG200_TEST", "UCR")
representation = GRAIL(kernel="SINK", d = 100, gamma = 5)
repTRAIN, repTEST = representation.get_rep_train_test(TRAIN, TEST, exact=True)
neighbors, _, _ = kNN(repTRAIN, repTEST, method="ED", k=5, representation=None,
pq_method='opq')
print(neighbors)
To load UCR type datasets:
TRAIN, train_labels = TimeSeries.load("ECG200_TRAIN", "UCR")
TEST, test_labels = TimeSeries.load("ECG200_TEST", "UCR")
In this package, we assume that each row of the datasets is a time series.
To fetch exact GRAIL representations of a training and a test dataset:
representation = GRAIL(kernel="SINK", d = 100, gamma = 5)
repTRAIN, repTEST = representation.get_rep_train_test(TRAIN, TEST, exact=True)
Here d
specifies the number of landmark series, and gamma
specifies the hyperparameter used for the SINK kernel. If gamma
is not specified, it will be tuned by the algorithm.
If a single dataset is used instead:
repX = representation.get_representation(X)
To get the approximate k-Nearest-Neighbors of TEST
in TRAIN
use:
neighbors, correlations, return_time = kNN(repTRAIN, repTEST, method="ED", k=5, representation=None,
pq_method='opq')
Note that Euclidean Distance in the GRAIL representation space estimates the SINK correlation in the original space.
FAQs
Python implementation of GRAIL
We found that grailts demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.