더북(TheBook)

다음으로 메서드를 실행하여 결과의 향상도와 확신도를 계산하고, main 메서드에서 시작할 것이다.


private static double calcLift(double occurrence, int transcationcount, long firstfreq, long otheritemoccurences) {
        return ((double)occurrence * transcationcount) / (firstfreq * otheritemoccurences);
    }

    private static double calcConviction(double confidence, int transactioncount, double otheroccurrences) {
        return (1.0 - otheroccurrences / transactioncount) / (1.0 - confidence);
    }

    public static void main(String[] args) throws Exception{
        Configuration configuration = new Configuration();
        processResults(configuration,loadItems());
    }

 

마지막 부분은 processResults 메서드다. 꽤 긴 코드인데, 빈도 패턴 파일을 읽어 데이터를 처리한다. 마지막에는 지지도, 신뢰도, 향상도, 확인도와 함께 아이템과 연관 아이템을 출력한다.

신간 소식 구독하기
뉴스레터에 가입하시고 이메일로 신간 소식을 받아 보세요.