Name: app-consumer-loan
Owner: H2O.ai
Description: null
Created: 2015-09-28 18:01:40.0
Updated: 2017-11-03 09:31:46.0
Pushed: 2016-11-22 19:49:46.0
Homepage: null
Size: 20672
Language: HTML
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
This example shows a generated Java POJO being called using a REST API from a JavaScript Web application.
The application simulates the experience of a consumer applying for a loan. The consumer provides some information about themselves and is either offered a loan or denied.
The “Building a Smarter Application” presentation given at H2O World 2015 references this repo.
(Front-end)
(Back-end)
Note: Not to be confused with the H2O embedded web port (default 54321) which is also powered by Jetty.
(Offline)
(Front-end)
(Back-end)
adle wrapper
http://h2o-release.s3.amazonaws.com/h2o/rel-tibshirani/2/index.html#R
gradlew build
gradlew jettyRunWar -x generateModels
(If you don't include the -x generateModels above, you will build the models again, which is time consuming.)
Make a prediction with curl and get a JSON response.
rl "localhost:8080/predict?loan_amnt=10000&term=36+months&emp_length=5&home_ownership=RENT&annual_inc=60000&verification_status=verified&purpose=debt_consolidation&addr_state=FL&dti=3&delinq_2yrs=0&revol_util=35&total_acc=4&longest_credit_length=10"
abelIndex" : 0,
abel" : "0",
lassProbabilities" : [
0.8581645524025798,
0.14183544759742012
nterestRate" : 12.079950220424134
Notes:
rl "localhost:8080/predict?loan_amnt=10000&term=36+months&emp_length=5&home_ownership=RENT&annual_inc=60000&verification_status=blahblah&purpose=debt_consolidation&addr_state=FL&dti=3&delinq_2yrs=0&revol_util=35&total_acc=4&longest_credit_length=10"
HTTP error response simplified below ...]
own categorical level (verification_status,blahblah)
Set VERBOSE to false in src/main/java/org/gradle/PredictServlet.java
./gradlew jettyRunWar -x war
Run apachebench as shown here:
-k -c 8 -n 10000 "localhost:8080/predict?loan_amnt=10000&term=36+months&emp_length=5&home_ownership=RENT&annual_inc=60000&verification_status=VERIFIED+-+income&purpose=debt_consolidation&addr_state=FL&dti=3&delinq_2yrs=0&revol_util=35&total_acc=4&longest_credit_length=10"
is ApacheBench, Version 2.3 <$Revision: 655654 $>
right 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
nsed to The Apache Software Foundation, http://www.apache.org/
hmarking localhost (be patient)
leted 1000 requests
leted 2000 requests
leted 3000 requests
leted 4000 requests
leted 5000 requests
leted 6000 requests
leted 7000 requests
leted 8000 requests
leted 9000 requests
leted 10000 requests
shed 10000 requests
er Software: Jetty(6.1.25)
er Hostname: localhost
er Port: 8080
ment Path: /predict?loan_amnt=10000&term=36+months&emp_length=5&home_ownership=RENT&annual_inc=60000&verification_status=VERIFIED+-+income&purpose=debt_consolidation&addr_state=FL&dti=3&delinq_2yrs=0&revol_util=35&total_acc=4&longest_credit_length=10
ment Length: 160 bytes
urrency Level: 8
taken for tests: 3.151 seconds
lete requests: 10000
ed requests: 0
e errors: 0
-Alive requests: 10000
l transferred: 2470247 bytes
transferred: 1600160 bytes
ests per second: 3173.23 [#/sec] (mean)
per request: 2.521 [ms] (mean)
per request: 0.315 [ms] (mean, across all concurrent requests)
sfer rate: 765.49 [Kbytes/sec] received
ection Times (ms)
min mean[+/-sd] median max
ect: 0 0 0.0 0 0
essing: 0 3 10.5 0 52
ing: 0 3 10.5 0 52
l: 0 3 10.5 0 52
entage of the requests served within a certain time (ms)
% 0
% 0
% 0
% 0
% 0
% 1
% 51
% 51
% 52 (longest request)
On a Macbook Pro with a 2.7 GHz Intel Core i7 this run gives:
The original data can be downloaded at https://www.lendingclub.com/info/download-data.action and it is all the data from 2007 to June 30, 2015. This does not incorporate the declined loan data set which does not have the same feature set. Note that some munging was done to distill the data to what is in this git repository.
The starting point for this example was taken from the gradle distribution. It shows how to do basic war and jetty plugin operations.