Skip to content

Instantly share code, notes, and snippets.

View frogbandit's full-sized avatar

James Xue frogbandit

  • Nova Credit
  • New York, NY
View GitHub Profile
@frogbandit
frogbandit / reconcileConfidenceScores.test.js
Created September 29, 2021 21:47
Nova Credit Income Model Reconcile Confidence Scores Tests
import { assert } from 'chai';
import reconcileConfidenceScores from '../src/reconcileConfidenceScores';
describe('reconcileConfidenceScores', () => {
it('filters out entries with empty confidence score inputs', () => {
const result = reconcileConfidenceScores([
{
score_conventional: 0,
score_non_conventional: 0,
@frogbandit
frogbandit / reconcileConfidenceScores.js
Last active September 29, 2021 21:28
Nova Credit Income Model Reconcile Confidence Scores
export interface ConfidenceScores {
score_conventional: number;
score_non_conventional: number;
score_non_wage?: number;
};
/**
* Given a list of inflow streams with confidence scores separated for wage, non-wage, and non-conventional,
* filter out any inflow streams below all thresholds, then find and map the highest score remaining
* as the final confidence score for the inflow stream.
@frogbandit
frogbandit / computeConfidenceScore.js
Last active September 29, 2021 21:20
Nova Credit Income Model Compute Confidence Score
/**
* Computes the sum of the intercept and the dot product of the coefficients and features for logistic regression model
* Using the formula s = b[0] + sum(b[1:] * x[1:])
* and then computes the confidence score from this sum using the formula p = 1 / (1 + exp(-s))
* @param normalizedFeatureValues the `x` vector, or the normalized model features
* @param coefficients the `b` vector, or the coefficients
* @param modelType conventional or non-conventional
*/
export const computeConfidenceScore = ({
normalizedFeatureValues,
@frogbandit
frogbandit / FindPalindromes
Created March 10, 2014 21:38
Find Palindromes: Identifies and prints out palindromes from a text file
//James Xue
import java.io.File;
import java.io.FileReader;
import java.io.BufferedReader;
import java.io.IOException;
public class FindPalindromes
{
public static void main(String args[]) throws IOException {