Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 175233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T13:39:46+00:00 2026-05-11T13:39:46+00:00

Ok, so here is a problem analogous to my problem (I’ll elaborate on the

  • 0

Ok, so here is a problem analogous to my problem (I’ll elaborate on the real problem below, but I think this analogy will be easier to understand).

I have a strange two-sided coin that only comes up heads (randomly) 1 in every 1,001 tosses (the remainder being tails). In other words, for every 1,000 tails I see, there will be 1 heads.

I have a peculiar disease where I only notice 1 in every 1,000 tails I see, but I notice every heads, and so it appears to me that the rate of noticing a heads or tails is 0.5. Of course, I’m aware of this disease and its effect so I can compensate for it.

Someone now gives me a new coin, and I noticed that the rate of noticing heads is now 0.6. Given that my disease hasn’t changed (I still only notice 1 in every 1,000 tails), how do I calculate the actual ratio of heads to tails that this new coin produces?


Ok, so what is the real problem? Well, I have a bunch of data consisting of input, and outputs which are 1s and 0s. I want to teach a supervised machine learning algorithm to predict the expected output (a float between 0 and 1) given an input. The problem is that the 1s are very rare, and this screws up the internal math because it becomes very susceptible to rounding errors – even with high-precision floating point math.

So, I normalize the data by randomly omitting most of the 0 training samples so that it appears that there is a roughly equal ratio of 1s and 0s. Of course, this means that now the machine learning algorithm’s output is no-longer predicting a probability, ie. instead of predicting 0.001 as it should, it would now predict 0.5.

I need a way to convert the output of the machine learning algorithm back to a probability within the original training set.

Author’s Note (2015-10-07): I later discovered that this technique is commonly known as ‘downsampling’

  • 1 1 Answer
  • 2 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T13:39:46+00:00Added an answer on May 11, 2026 at 1:39 pm

    You are calculating the following

    calculatedRatio = heads / (heads + tails / 1000) 

    and you need

    realRatio = heads / (heads + tails) 

    Solving both equations for tails yields the following equations.

    tails = 1000 / calculatedRatio - 1000 tails = 1 / realRatio - 1 

    Combining both yields the following.

    1000 / calculateRatio - 1000 = 1 / realRatio - 1 

    And finally solving for realRatio.

    realRatio = 1 / (1000 / calculatedRatio - 999) 

    Seems to be correct. calculatedRatio 0.5 yields realRatio 1/1001, 0.6 yields 3 / 2003.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem here with this code. I'm opening a socket, then listening
I have problem here, I need all the stuffs inside this $_SESSION['cart'] thing and
hi all i have implemented code as shown in the below here problem is
I have a problem analogous to the one described here: Prevent fork() from copying
Simple problem here (I think). I have a form with a checkbox at the
very simple problem here... but I can't work it out. I have a simple
Maddening problem here. When my page loads: <body onload=getClientDateTime();> It runs this function: document.getElementById('ClientDateTime').value=hello
I have a problem here. My Zend_Forms do not render in view script. Via
I have a problem here I can't solve. I have a database of houses
enter code here My problem is this: in this database the junction table contains

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.