Weka 에러 메시지 Cannot instantiate the type Instance, 해결방법

CODEDRAGON Development/Java

반응형



 

 

 

Weka 에러 메시지

Cannot instantiate the type Instance


 

 

 

 

에러 원인

Instance 클래스가 아니라 인터페이스로 정의가 되어 있어 new 키워드로 객체 생성할 없습니다.

 

 

weka.core.Instance

http://weka.sourceforge.net/doc.dev/weka/core/Instance.html


 

 

 

 

 

 

 

해결 방법

"All Known Implementing Classes:" 항목에서 해당 Interface 구현하고 있는 클래스를 사용해주면 해결됩니다.


 

 

수정

// 인터페이스라 객체 생성 불가

Instance testInstance = new Instance(1.0, newdata);

수정

// Instance 인터페이스를 구현한 클래스 사용

Instance testInstance = new DenseInstance(2);

testInstance.setDataset(data);

testInstance.setValue(0, newdata[0]);

testInstance.setValue(1, newdata[1]);

 

 


반응형