mikeizbicki / HLearn

Homomorphic machine learning
Other
1.63k stars 138 forks source link

HLearn-classification install trouble #19

Closed tcfuji closed 11 years ago

tcfuji commented 11 years ago

Hi, Beginner Haskell user here. While trying to install HLearn-classification, I received the following:

src/HLearn/Models/Classifiers/Bayes.hs:51:40: Could not deduce (label ~ prob) from the context (Labeled (Datapoint (Bayes labelLens dist)), Margin labelLens dist ~ Categorical label prob, Ord label, Ord prob, Fractional prob, label ~ Label (Datapoint dist), prob ~ Probability (MarginalizeOut labelLens dist), Labeled (Datapoint dist), Datapoint (MarginalizeOut labelLens dist) ~ Attributes (Datapoint dist), PDF (MarginalizeOut labelLens dist), PDF (Margin labelLens dist), Marginalize labelLens dist) bound by the instance declaration at src/HLearn/Models/Classifiers/Bayes.hs:(36,5)-(45,53) label' is a rigid type variable bound by the instance declaration at src/HLearn/Models/Classifiers/Bayes.hs:36:5 prob' is a rigid type variable bound by the instance declaration at src/HLearn/Models/Classifiers/Bayes.hs:36:5 Expected type: label Actual type: Probability (MarginalizeOut labelLens dist) In the return type of a call of pdf' In the second argument of()', namely `pdf (attrDist k) dp' In the expression: pdf labelDist k \ pdf (attrDist k) dp Failed to install HLearn-classification-1.0.1.1 cabal: Error: some packages failed to install: HLearn-classification-1.0.1.1 failed during the building phase. The exception was: ExitFailure 1

Any help would be greatly appreciated.

Ted

mikeizbicki commented 11 years ago

Which version of GHC are you using? HLearn requires GHC 7.6, and most installation problems seem to be because of using an older version. Just running ghc --version should tell you.

tcfuji commented 11 years ago

The Glorious Glasgow Haskell Compilation System, version 7.6.3. Could it be a dependency problem?

mikeizbicki commented 11 years ago

Are you using the hackage version or one of the github versions?

tcfuji commented 11 years ago

Hackage version.

The same thing happened when I tried to build a github clone.

mikeizbicki commented 11 years ago

It must be a dependency issue somehow, but that's a really weird looking error message for dependencies being the wrong version. If you delete your ~/.cabal/packages directory, that uninstalls everything. So then it should just install HLearn-classification using the right versions of everything. This has worked for other people using the latest Haskell platform.

I should probably go through and start removing as many dependencies as possible so that this happens less often.

tcfuji commented 11 years ago

Did you mean delete the .cabal folder? If so, I tried that and got the same result.

mikeizbicki commented 11 years ago

That's what I meant.

Hmm... This is really weird. Are you starting from the latest Haskell platform or something different? What's your OS?

tcfuji commented 11 years ago

I have some bad news: I uninstalled my entire Haskell platform and libraries, downloaded the latest version, and installed it. I ran "cabal install HLearn-classification". All the new versions of the dependencies were installed automatically. Unfortunately, I received the same output as before. If it matters, I am using OS X version 10.8.4.

mikeizbicki commented 11 years ago

I just uninstalled and reinstalled everything too, now I'm running into the same error. Some downstream package must have changed and broken something. I pushed a new change to the master branch on git that fixes it for me.
Can you see if it works for you before I package it up for hackage?

tcfuji commented 11 years ago

Good News: I installed it successfully! I would like to test it on the Weka experiment, but I could use some help adjusting some of the settings inside the weka-cv.sh file to point to the correct install locations of Java and Weka. I get the following output:

hlearn-cv.lhs:17:9: Could not find module `Data.Csv' Locations searched: Data/Csv.hs Data/Csv.lhs

Is the Data.Csv file supposed to be downloaded with HLearn?

mikeizbicki commented 11 years ago

No, that's part of the cassava package.

tcfuji commented 11 years ago

I installed the cassava package. Unfortunately, I received the following after running the command ghc -O2 hlearn-cv.lhs:

hlearn-cv.lhs:102:60: Couldn't match type [Char]' withDouble' In the second argument of crossValidate_group', namely (errorRate :: LossFunction NB)' In the expression: crossValidate_group (folds numfolds rawdata) (errorRate :: LossFunction NB) In an equation for `res': res = crossValidate_group (folds numfolds rawdata) (errorRate :: LossFunction NB)

mikeizbicki commented 11 years ago

Thanks for your patience with all of this. The problem with this part is that the HLearn-classification package is bringing in newer versions of the other HLearn packages that it's not compatible with. Here's a temporary fix that will get it compiling right now. First, delete the HLearn-* files in ~/.ghc/[your arch here]/package.conf.d/. Then install these versions of the packages:

cabal install HLearn-algebra-1.0.0.1 cabal install HLearn-distributions-1.0.0.1 cabal install HLearn-classification-1.0.1.1

This shouldn't take very long because you'll already have all the other dependencies installed.

I'm super busy this week, but hopefully Monday or Tuesday next week I'll get the dependencies straight on these packages and upload a cleaner version to hackage.

mikeizbicki commented 11 years ago

Everything should work now. I've made a bunch of changes in the dev branch of the github repository to simplify the dependency structure a lot. Now, everything should just work if you cabal install that branch.

There's still a lot more changes that need to be made until the next release, so I'm not pushing this version to hackage quite yet.