dedupeio / rlr Goto Github PK
View Code? Open in Web Editor NEWRegularized Logistic Regression
License: Other
Regularized Logistic Regression
License: Other
It seems like the rlr.RegularizedLogisticRegression() classifier can get stuck in local minima. Doing multiple runs of fit
on the same data, I get different values for weights
and bias
:
>>> distances = np.array([[ 0.32363278, 0.40278021, 0.0999007 ],
[ 0.32363278, 0.65415895, 0.06500483],
[ 0.32363278, 0.43124139, 0.33864626],
[ 0.71153408, 0.98082042, 0.97221285],
[ 0.23200932, 0.37879705, 0.87567651]])
>>> y = np.array([0, 0, 1, 1, 1])
>>> for _ in range(5):
classifier = rlr.RegularizedLogisticRegression()
classifier.fit(distances, y)
print('Weights: ', classifier.weights, ' | Bias: ', classifier.bias)
INFO:rlr.crossvalidation:using cross validation to find optimum alpha...
INFO:rlr.crossvalidation:optimum alpha: 0.100000
INFO:rlr.crossvalidation:using cross validation to find optimum alpha...
Weights: [ 0.26613167 -0.1486545 3.13623194] | Bias: -0.903821317466
/usr/local/lib/python3.5/dist-packages/rlr/crossvalidation.py:122: RuntimeWarning: invalid value encountered in true_divide
* (true_distinct + false_distinct)))
INFO:rlr.crossvalidation:optimum alpha: 1.000000
INFO:rlr.crossvalidation:using cross validation to find optimum alpha...
Weights: [ 0.08961837 0.04917397 0.65640814] | Bias: 0.0419131239574
INFO:rlr.crossvalidation:optimum alpha: 0.010000
INFO:rlr.crossvalidation:using cross validation to find optimum alpha...
Weights: [ 0.13760738 -1.73163954 8.77028282] | Bias: -1.52055491953
INFO:rlr.crossvalidation:optimum alpha: 1.000000
INFO:rlr.crossvalidation:using cross validation to find optimum alpha...
Weights: [ 0.08961837 0.04917397 0.65640814] | Bias: 0.0419131239574
INFO:rlr.crossvalidation:optimum alpha: 0.100000
Weights: [ 0.26613167 -0.1486545 3.13623194] | Bias: -0.903821317466
NB: the input data was generated using ActiveMatching.data_model.distances
on a real example in dedupe.
The Readme should be expanded to include:
When one passes empty array(s) into the lr
one gets an error from the bowels of numpy that looks a little like this:
IndexError: index 0 is out of bounds for axis 0 with size 0
It should be simple enough to test whether or not the arrays have anything in them and then raise an exception earlier.
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.