Learning Parameters When Some Data is Missing - Sprinkler Example

답변됨 Learning Parameters When Some Data is Missing - Sprinkler Example

  • 2012년 4월 6일 금요일 오후 5:09
     
     

    Noob question please :) In the sprinkler example packaged with Infer.NET, the 2nd part of the program attempts to learn parameters of the model given data C, S, R, W. What if I cannot observe C, but would still like to infer ProbCloudyPosterior?

    Thanks a lot in advance

모든 응답

  • 2012년 4월 7일 토요일 오전 10:37
     
     답변됨

    In LearnParameters you will see the line

      Cloudy.ObservedValue = cloudy;

    If you change this to:  

      Cloudy.ClearObservedValue();

    Then Cloudy will be left unobserved.  See ProbRain for an example of this.

    • 답변으로 표시됨 exx 2012년 4월 9일 월요일 오후 4:41
    • 답변으로 표시 취소됨 exx 2012년 4월 17일 화요일 오후 10:29
    • 답변으로 표시됨 exx 2012년 4월 18일 수요일 오후 6:14
    • 답변으로 표시 취소됨 exx 2012년 4월 18일 수요일 오후 7:20
    • 답변으로 표시됨 exx 2012년 4월 18일 수요일 오후 7:20
    •  
  • 2012년 4월 9일 월요일 오후 4:41
     
     
    Thanks a lot Tom!
  • 2012년 4월 17일 화요일 오후 10:34
     
     

    Hi Tom,

    It seems that if I do not provide any observed values to Cloudy (i.e. Cloudy.ClearObservedValue()), the model has a very hard time learning the probabilities. The learned probabilities, even when I generate 10,000 sample data points, are:

        Prob. Cloudy:                                            Ground truth: 0.30, Inferred: 0.50
        Prob. Sprinkler | Cloudy:                            Ground truth: 0.10, Inferred: 0.38
        Prob. Sprinkler | Not Cloudy:                      Ground truth: 0.50, Inferred: 0.38
        Prob. Rain      | Cloudy:                              Ground truth: 0.80, Inferred: 0.38
        Prob. Rain      | Not Cloudy:                        Ground truth: 0.20, Inferred: 0.38
        Prob. Wet Grass | Sprinkler, Rain:               Ground truth: 0.99, Inferred: 0.99
        Prob. Wet Grass | Sprinkler, Not Rain          Ground truth: 0.90, Inferred: 0.89
        Prob. Wet Grass | Not Sprinkler, Rain:         Ground truth: 0.90, Inferred: 0.90
        Prob. Wet Grass | Not Sprinkler, Not Rain:   Ground truth: 0.00, Inferred: 0.00

    (note: I changed the actual prob. cloudy from (0.5, 0.5) in the original code to (0.3, 0.7)).

    Any help is greatly appreciated.


    • 편집됨 exx 2012년 4월 17일 화요일 오후 10:35
    • 답변으로 표시됨 exx 2012년 4월 18일 수요일 오후 6:14
    • 답변으로 표시 취소됨 exx 2012년 4월 18일 수요일 오후 6:14
    •  
  • 2012년 4월 18일 수요일 오전 10:46
     
     답변됨

    By the looks of it, the parameters have come out symmetric.  When you don't observe Cloudy, the model effectively becomes a mixture model.  So you have to be careful about breaking symmetry as explained in the Mixture of Gaussians example.


    • 편집됨 Tom MinkaMicrosoft Employee 2012년 4월 18일 수요일 오전 10:47
    • 답변으로 표시됨 exx 2012년 4월 18일 수요일 오후 6:14
    • 답변으로 표시 취소됨 exx 2012년 4월 18일 수요일 오후 7:20
    • 답변으로 표시됨 exx 2012년 4월 18일 수요일 오후 7:20
    •  
  • 2012년 4월 18일 수요일 오후 6:54
     
     

    Thanks so much Tom. Did as you suggested, and now, P(S | C) and P(R | C) are better calculated. But it seems P(C) still can't be inferred.

    Prob. Cloudy:                                       Ground truth: 0.30, Inferred: 0.50
    Prob. Sprinkler | Cloudy:                        Ground truth: 0.10, Inferred: 0.16
    Prob. Sprinkler | Not Cloudy:                   Ground truth: 0.50, Inferred: 0.60
    Prob. Rain      | Cloudy:                         Ground truth: 0.80, Inferred: 0.60
    Prob. Rain      | Not Cloudy:                    Ground truth: 0.20, Inferred: 0.16
    Prob. Wet Grass | Sprinkler, Rain:            Ground truth: 0.99, Inferred: 0.99
    Prob. Wet Grass | Sprinkler, Not Rain        Ground truth: 0.90, Inferred: 0.90
    Prob. Wet Grass | Not Sprinkler, Rain:       Ground truth: 0.90, Inferred: 0.90
    Prob. Wet Grass | Not Sprinkler, Not Rain: Ground truth: 0.00, Inferred: 0.00


    • 편집됨 exx 2012년 4월 18일 수요일 오후 7:20
    • 편집됨 exx 2012년 4월 18일 수요일 오후 7:26
    •  
  • 2012년 4월 19일 목요일 오후 12:47
     
     
    Yes, it isn't possible to recover the true parameters exactly when cloudy is not observed.  This is because the model has too many parameters.  There is 1 for cloudy, 2 for sprinkler, 2 for rain, totalling 5 for p(sprinkler,rain) alone.  But you only need 3 parameters to describe any joint distribution of (sprinkler,rain).