All Projects → hsz1273327 → ScoreCardModel

hsz1273327 / ScoreCardModel

Licence: other
Score card model for Credit Scoring System.

Programming Languages

python
139335 projects - #7 most used programming language
Makefile
30231 projects
Batchfile
5799 projects

Projects that are alternatives of or similar to ScoreCardModel

Ta Rs
Technical analysis library for Rust language
Stars: ✭ 248 (+136.19%)
Mutual labels:  finance, math
Alpha Mind
quantitative security portfolio analysis. The analysis pipeline including data storage abstraction, alpha calculation, ML based alpha combining and portfolio calculation.
Stars: ✭ 171 (+62.86%)
Mutual labels:  finance, math
Math Php
Powerful modern math library for PHP: Features descriptive statistics and regressions; Continuous and discrete probability distributions; Linear algebra with matrices and vectors, Numerical analysis; special mathematical functions; Algebra
Stars: ✭ 2,009 (+1813.33%)
Mutual labels:  finance, math
good-reads
List of inspiring articles, blogs, tutorials and books. Tech stuff.
Stars: ✭ 14 (-86.67%)
Mutual labels:  finance, math
abacus
📐 C# cross precision 3D maths library.
Stars: ✭ 35 (-66.67%)
Mutual labels:  math
langtons-ant
Langton’s Ant macOS screen saver written in Swift
Stars: ✭ 12 (-88.57%)
Mutual labels:  math
SCNMathExtensions
Math extensions for SCNVector3, SCNQuaternion, SCNMatrix4
Stars: ✭ 32 (-69.52%)
Mutual labels:  math
budget-manager
Easy-to-use, lightweight and self-hosted solution to track your finances
Stars: ✭ 20 (-80.95%)
Mutual labels:  finance
react-katex
Display math in TeX with KaTeX and ReactJS
Stars: ✭ 135 (+28.57%)
Mutual labels:  math
Fourier-and-Images
Fourier and Images
Stars: ✭ 81 (-22.86%)
Mutual labels:  math
bewl
A DSL for the internal language of a topos
Stars: ✭ 41 (-60.95%)
Mutual labels:  math
alokmenghrajani.github.com
Alok Menghrajani's Blog
Stars: ✭ 64 (-39.05%)
Mutual labels:  math
fundamentos
Download Bovespa Stock Market fundamentals with Python.
Stars: ✭ 80 (-23.81%)
Mutual labels:  finance
Mida
The open-source and cross-platform trading framework
Stars: ✭ 263 (+150.48%)
Mutual labels:  finance
wolf
🐺 Binance trading bot for node.js
Stars: ✭ 76 (-27.62%)
Mutual labels:  finance
commons-statistics
Statistics
Stars: ✭ 35 (-66.67%)
Mutual labels:  math
VSCode-LaTeX-Inkscape
✍️ A way to integrate LaTeX, VS Code, and Inkscape in macOS
Stars: ✭ 62 (-40.95%)
Mutual labels:  math
pyEX
Python interface to IEX and IEX cloud APIs
Stars: ✭ 407 (+287.62%)
Mutual labels:  finance
perl-scripts
A nice collection of day-to-day Perl scripts.
Stars: ✭ 92 (-12.38%)
Mutual labels:  math
VsTeXCommentsExtension
TeX comments rendering inside Visual Studio.
Stars: ✭ 48 (-54.29%)
Mutual labels:  math

ScoreCardModel

Description

a simple tool for score card model

keywords:math,finance

Feature

  • Serializable
  • mutil classifier model support
  • ks-curve support

Change

  • scorecard now can set a threshold value to return a bool result

Example

>>> from sklearn import datasets
>>> import pandas as pd
>>> from ScoreCardModel.binning.discretization import Discretization
>>> from ScoreCardModel.weight_of_evidence import WeightOfEvidence
>>> from ScoreCardModel.models.logistic_regression_model import LogisticRegressionModel
>>> from ScoreCardModel.score_card import ScoreCardModel
>>>
>>> class MyLR(LogisticRegressionModel):
>>>     def predict(self, x):
>>>          x = self.pre_trade(x)
>>>          return self._predict_proba(x)
>>>      
>>>     def pre_trade(self, x):
>>>         import numpy as np
>>>         result = []
>>>         for i,v in x.items():
>>>             t = self.ds[i].transform([v])[0]
>>>             r = self.woes[i].transform([t])[0]
>>>             result.append(r)
>>>         return np.array(result)
>>>
>>>     def _pre_trade_batch_row(self,row,Y,bins):
>>>         d = Discretization(bins)
>>>         d_row = d.transform(row)
>>>         woe = WeightOfEvidence()
>>>         woe.fit(d_row,Y)
>>>         return d,woe,woe.transform(d_row)
>>>     
>>>     def pre_trade_batch(self, X,Y):
>>>         self.ds = {}
>>>         self.woes = {}
>>>         self.table = {}
>>>         self.ds["sepal length (cm)"],self.woes["sepal length (cm)"],self.table["sepal length (cm)"]= self._pre_trade_batch_row(
>>>             X["sepal length (cm)"],Y,[0,2,5,8])
>>>         self.ds['sepal width (cm)'],self.woes['sepal width (cm)'],self.table['sepal width (cm)'] = self._pre_trade_batch_row(
>>>             X['sepal width (cm)'],Y,[0,2,2.5,3,3.5,5])
>>>         self.ds['petal length (cm)'],self.woes['petal length (cm)'],self.table['petal length (cm)'] = self._pre_trade_batch_row(
>>>             X['petal length (cm)'],Y,[0,1,2,3,4,5,7])
>>>         self.ds['petal width (cm)'],self.woes['petal width (cm)'],self.table['petal width (cm)'] = self._pre_trade_batch_row(
>>>             X['petal width (cm)'],Y,[0,1,2,3])
>>>         return pd.DataFrame(self.table)
>>>
>>> iris = datasets.load_iris()
>>> y = iris.target
>>> z = (y==0)
>>> l = pd.DataFrame(iris.data,columns=iris.feature_names)
>>> lr = MyLR()
>>> lr.train(l,z)
>>> lr.predict(l.loc[0].to_dict())
array([[ 0.46315882,  0.53684118]])
>>> sc = ScoreCardModel(lr)
>>> sc.predict(sc.pre_trade(l.loc[0].to_dict()))
104.3
>>> scs = []
>>> for i in range(len(l)):
>>>    score = sc.predict(sc.pre_trade(l.loc[i].to_dict()))
>>>    scs.append(score)
>>> print(ScoreCardWithKSModel.Threshold_to_score(scs, 0.5))
1.0
>>> print(ScoreCardWithKSModel.Score_to_threshold(scs, score=70))
1.0
             precision    recall  f1-score   support

      False       1.00      1.00      1.00        29
       True       1.00      1.00      1.00        16

avg / total       1.00      1.00      1.00        45
>>> print(ScoreCardWithKSModel.Score_to_threshold(scs, y=z, score=100))
0.3467
>>> print(ScoreCardWithKSModel.Get_ks(scs, y=z, threshold=0.4).ks)
0.9
>>> # ScoreCardWithKSModel.Drawks(scs, y=z)
>>> scsc = [l.loc[i].to_dict() for i in range(len(l))]
>>> scks = ScoreCardWithKSModel.From_scorecard(sc)
>>> print(scks.threshold_to_score(scsc, 0.5))
1.0
>>> print(scks.score_to_threshold(scsc, score=70))
1.0
             precision    recall  f1-score   support

      False       1.00      1.00      1.00        29
       True       1.00      1.00      1.00        16

avg / total       1.00      1.00      1.00        45
>>> print(scks.score_to_threshold(scsc, y=z, score=100))
0.3467
>>> print(scks.get_ks(scsc, y=z, threshold=0.4).ks)
0.9
>>> scks.drawks(scsc, y=z)

Install

python -m pip install ScoreCardModel

Documentation

Documentation on github page https://data-science-tools.github.io/ScoreCardModel/

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].