0

나는 시간과 온도 (x, y)의 표본을 가지고 있으며 온도가 섭씨 영하 35도 (예 : 35도) 인 시간을 알아야합니다.아파치 커먼즈 또는 다른 자바와 비선형 모델을 해결하는 방법?

필자의 샘플은 거의 없으며, 미적분의 시작을 위해 3 개의 샘플을 사용합니다. 따르기 :

Temperature | Time (s) 
    25  | 0 
    27  | 10 
    33  | 17 
    40  | ? 

나는 정확한 결과를 위해 더 많은 표본이 필요하다는 것을 알고 있지만, 이것을 시작하기 위해 나는 이것을 사용한다.

질문은 어떻게 구현합니까? 나는 Apache Commons에 대해 다음과 같이 배웁니다.

org.apache.commons3.optim.nonlinear.scalar 그러나이 lib 사용법을 모르겠습니다. 미적분을위한 코드 예제가 필요합니다. 감사합니다.

+0

알려진 데이터를 기반으로 패턴을 작성하고 패턴을 사용하여 마지막으로 가져와야 할 것으로 보입니다. 이것은 기계 학습을위한 가장 간단한 문제입니다. WEKA를 시험해 볼 수 있습니다. –

답변

1

당신이 달성하려는 것을 오해하지 않는 한, 간단한 문제를 복잡하게 만드는 것처럼 보입니다.

Linear Regression 문제로 취급이 같은 수행 할 SimpleRegression 아파치 코 몬즈 클래스를 사용하는 것이 문제를 해결하는 가장 쉬운 방법 :

import org.apache.commons.math3.stat.regression.SimpleRegression; 

public class MySimpleRegression { 
    public static void main(String[] args) { 

     // create a Simple Regression object 
     SimpleRegression simpleRegression = new SimpleRegression(); 

     // create your data object with various instances of x, y - make the 
     // variable you want to predict the 'y' in your data 
     // i.e. if you wanna predict the time at a given temperature, 
     // 'x' would be temperature and 'y' time 

     double[][] data = { { 25, 0 }, {27, 10 }, {33, 17 }, {40, 20 }}; 

     // pass this data to your simple regression object 
     simpleRegression.addData(data); 

     // and then you can predict the time at a given temperature value 
     System.out.println("Predicted Time: " + simpleRegression.predict(35)); 

     // You can also get the slope and intercept from your data 
     System.out.println("slope = " + simpleRegression.getSlope()); 
     System.out.println("intercept = " + simpleRegression.getIntercept()); 
    } 
} 

이 해결하는 더 간단한 방법처럼 보인다 당신의 문제. 바라기를 이것은 당신 또는 다른 누군가를 돕는다.

피씨 : 이것을 실행하지 않았습니다. 그래도 잘 작동해야합니다.