若是凉夜已成梦

青春里 总有些事情要努力去做 总有些梦想要拼命去追。


  • 运维

  • 前端

  • 编程

  • 随笔

  • hust-oj

1179: Practice

发表于 2017-10-06   |   分类于 HUSTOJ   |   阅读次数 1,228

题目描述

How much does winning ACM depend on practice?
We assume that p, the probability that a given team will win a given contest, is related to n, the number of practice problems solved by the team prior to the contest. This relationship is modelled by the logistic formula

log(p/(1-p)) = a + b n ,

for some
a
and
b
. Your job is to find
a
and
b
such that the formula most accurately reflects a set of observed results.
Each observation consists of n and w. n is the number of practice problems solved by some team prior to a contest, and w is 1 if the team wins the contest, 0 if it does not.
Given a, b, and n the formula above may be used to compute p, the estimated probability that w = 1. The likelihood of a particular observation is p if w = 1 and 1-p if w = 0; The likelihood of a set of observations is the product of the likelihoods of the individual observations.
You are to compute the maximum likelihood estimate for a and b. That is, the values of a and b for which the likelihood of a given set of observations is maximized.
The input contains several test cases followed by a line contatining 0. Each test case begins with 1 < k ≤ 100, the number of observations that follow. Each observation consists of integers 0 ≤ n ≤ 100 and 0 ≤ w ≤ 1. The input will contain at least two distinct values of n and of w. For each test case, output a single line containing a and b, rounded to four digits to the right of the decimal.

输入

暂无

输出

暂无

样例输入

20
0 0
0 0
0 0
0 0
1 0
1 0
1 0
1 1
2 0
2 0
2 1
2 1
3 0
3 1
3 1
3 1
4 1
4 1
4 1
4 1
0

样例输出

-3.1748 1.5874

参考代码

暂无

解析

暂无

hustoj

发表评论 取消回复

电子邮件地址不会被公开。 必填项已用*标注

*
*


hoxis wechat
著作权归作者所有
站点更新说明
  • 文章目录
  • 站点概览
若是凉夜已成梦

若是凉夜已成梦

青春里 总有些事情要努力去做 总有些梦想要拼命去追。

1904 日志
6 分类
12 标签
RSS
weibo github twitter facebook

友情链接

Dreams孤独患者 Skip 原站点
© 2017 若是凉夜已成梦
Powered by WordPress | 已运行
Theme By NexT.Mist