Giter Club home page Giter Club logo

whg's Introduction

README

This is a Ruby on Rails app that will guess age based on weight and height.

The base data is from this website: www.brianmac.co.uk/idealw.htm#ref

  • Ruby version: ruby 2.2.2p95

  • Rails version: Rails 4.2.3

  • Database creation: a startup mysql database dump can be found in db/ha_development.sql

How do I tackle the problem:

During my research for the base data, I found out most data sets for weights are within a range like this:

height         |   male weight  |    female weight
5'3"           |    113 - 141   |      106 - 134

There is a overlaps for both gender in the middle and difinitly gander domininant result on both the lower and higher end. Therefore, I boeke down the range into the following:

female min  |   male min  |  female max |  male max
106         |113          |          134|       141
|---female--|------------ even ---------|---male---|
  dominant               dominant         dominant

Assuming the data is collect from 1000 people from each gender, the guess falls in male min and female max weight will get a 50% chance for either gender, below male min will be 100% female, and above female max will be 100% male initially according to the base data.

The chance is calculated by using scaling data in the database. There is a female and male dominant scale for each of the 3 ranges. Initially, the

* female dominant range: female scale:1000 vs male scale:0 
* even dominant range: female scale:1000 vs male scale:1000
* male dominant range: female scale:0 vs male scale:1000

The chance equation is:

scale = female scale / ( female scale + male scale)
chance = rand(0..1)/10 < scale

if chance is true, guess is female
if chance is fale, guess is male

When people start to guess, they will be shown a guess result and a right and wrong buttons to interact with. These 2 buttons will update the database for the scales columns accordingly. For example, a girl puts in 4’10“ and 42 lb, she will be shown the answer ”female“. When she clicks the ”right“ button, the database will update the female dominant scale with increment of 1. If a boy puts in 4’10” and 42 lb and clicks on the “wrong” button, the male nondominant scale will increase by 1. When many more inputs are given, the scale for female dominant will be slightly smaller than but still close 1 and more statiscally correct.

whg's People

Contributors

eforblue avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.