Skip to content

Instantly share code, notes, and snippets.

City of Chicago
Individual Contributor License Agreement ("Agreement")
Thank you for your interest in [Project Name] by the City of Chicago (the "City"), a municipal corporation and home rule unit of local government existing under the Constitution of the State of Illinois. In order to clarify the intellectual property license granted with Contributions from any person or entity, the City must have a Contributor License Agreement ("CLA") on file that has been signed by each Contributor, indicating agreement to the license terms below. This license is for your protection as a Contributor as well as the protection of the City and its users; it does not change your rights to use your own Contributions for any other purpose.
You accept and agree to the following terms and conditions for Your present and future Contributions submitted to the City. In return, the City shall not use Your Contributions in a way that it believes is contrary to the public benefit. Except for the license granted herein to the City an
"""
Author: Oliver Mitevski
References:
A Generalized Linear Model for Principal Component Analysis of Binary Data,
Andrew I. Schein; Lawrence K. Saul; Lyle H. Ungar
The code was translated and adapted from Jakob Verbeek's
"Hidden Markov models and mixtures for Binary PCA" implementation in MATLAB
class OnlineLearner(object):
def __init__(self, **kwargs):
self.last_misses = 0.
self.iratio = 0.
self.it = 1.
self.l = kwargs["l"]
self.max_ratio = -np.inf
self.threshold = 500.
def hinge_loss(self, vector, cls, weight):