thu-vis / libsampling Goto Github PK
View Code? Open in Web Editor NEWA library of sampling algorithms
License: MIT License
A library of sampling algorithms
License: MIT License
Currently, it is not possible to use DensityBasedSampling in this package. The code below, taken from the README, would be expected to successfully create a sampled dataset.
from sampling.Sampler import *
from sampling.SamplingMethods import *
import numpy as np
data = np.array([[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]])
labels = np.array([0, 1, 0, 1, 0])
sampler = Sampler() # Initialize the Sampler object
sampler.set_data(data, labels)
# data: an (n*2) numpy array indicating the point coordinates
# labels: an (n*1) numpy array indicating the class labels with integers 0, 1, 2, ...
# or None if you use single-class sampling methods
sampler.set_sampling_method(DensityBiasedSampling, sampling_rate=0.5)
indices = sampler.sample()
# indices: an (m*1) numpy array indicating the indices of the sampling result
sampled_data, sampled_labels = sampler.get_samples()
# sampled_data: an (m*2) numpy array indicating the sampled point coordinates
# sampled_labels: an (m*2) numpy array indicating the class labels of the sampled points
However, it throws the following error:
, line 14, in <module>
indices = sampler.sample()
AttributeError: 'Sampler' object has no attribute 'sample'
This error does not occur when sampling method RandomSampling is used.
What is the source of knnDll.dll
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.