GithubHelp home page GithubHelp logo

mikeizbicki / hlearn Goto Github PK

View Code? Open in Web Editor NEW
1.6K 1.6K 138.0 17.12 MB

Homomorphic machine learning

License: Other

C 0.67% Shell 2.64% Python 0.22% Haskell 85.84% R 0.39% Java 0.89% Makefile 0.14% C++ 9.21%

hlearn's People

Contributors

andychase avatar cdepillabout avatar cheecheeo avatar davorak avatar ehlemur-zz avatar he-chien-tsai avatar mikeizbicki avatar npezolano avatar sindikat avatar tonyday567 avatar unkindpartition avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hlearn's Issues

Unable to install HLearn-algebra

Getting the following errors from the cabal install:

[2 of 7] Compiling HLearn.Algebra.Structures.Modules ( src/HLearn/Algebra/Structures/Modules.hs, dist/build/HLearn/Algebra/Structures/Modules.o )

src/HLearn/Algebra/Structures/Modules.hs:94:5:
Illegal tuple constraint (Num r, Ord a)
(Use -XConstraintKinds to permit this)
In the type synonym instance declaration for CK.FunctorConstraint' In the instance declaration forCK.Functor (FreeMod r)'

src/HLearn/Algebra/Structures/Modules.hs:98:5:
Illegal tuple constraint (Num r, Ord a, Operator r a)
(Use -XConstraintKinds to permit this)
In the type synonym instance declaration for CK.FoldableConstraint' In the instance declaration forCK.Foldable (FreeMod r)'
cabal: Error: some packages failed to install:
HLearn-algebra-0.1.0.1 failed during the building phase. The exception was:
ExitFailure 1

Error installing HLearn-distributions-1.0.0.1

I attempted to install the HLearn packages using the following command:

cabal install HLearn-classification HLearn-algebra HLearn-distributions HLearn-datastructures HLearn-approximation -j

This was in a completely fresh hsenv, using ghc-7.6.3. Installation failed at HLearn-distributions 1.0.0.1, with the following message:

src/HLearn/Models/Distributions/Multivariate/Interface.hs:98:60:
`Index' is applied to too many type arguments
In the instance declaration for `Marginalize' (Nat1Box n) (Multivariate dp xs
prob)'

After a lot of messing around with various versions of the repository (I wasn't able to figure out what commit in the repository corresponds to the versions uploaded to Hackage, if there is such a commit) and encountering many many other errors, I managed to get it to compile by getting the source from Hackage, and editing src/HLearn/Models/Distributions/Multivariate/Interface.hs to uncomment the type family Index lines, and hide Index from the import of HLearn.Algebra.

Link to HLearn-markov broken

Link to HLearn-markov broken in README.md. I could not find the matching package on Hackage after minute or two of searching hackage.

Not in scope: type constructor or class Unbox'

Installing HLearn-distributions from the repository version, I get an error:

$ cabal build
Building HLearn-distributions-0.0.1...
Preprocessing library HLearn-distributions-0.0.1...
[1 of 4] Compiling HLearn.Models.Distributions.Common ( src/HLearn/Models/Distributions/Common.hs, dist/build/HLearn/Models/Distributions/Common.o )
[2 of 4] Compiling HLearn.Models.Distributions.Categorical ( src/HLearn/Models/Distributions/Categorical.hs, dist/build/HLearn/Models/Distributions/Categorical.o )
[3 of 4] Compiling HLearn.Models.Distributions.Gaussian ( src/HLearn/Models/Distributions/Gaussian.hs, dist/build/HLearn/Models/Distributions/Gaussian.o )

src/HLearn/Models/Distributions/Gaussian.hs:59:33:
    Not in scope: type constructor or class Unbox'
    Perhaps you meant `U.Unbox' (imported from Data.Vector.Unboxed)

This is on GHC 7.4.2.

markov build error

wojtek@wojtek-desktop:~/src/HLearn/HLearn-markov$ cabal install HLearn-markov.cabal
Resolving dependencies...
Configuring HLearn-markov-1.0.0...
Building HLearn-markov-1.0.0...
Preprocessing library HLearn-markov-1.0.0...
[1 of 1] Compiling HLearn.Models.Markov.MarkovChain ( src/HLearn/Models/Markov/MarkovChain.hs, dist/build/HLearn/Models/Markov/MarkovChain.o )

src/HLearn/Models/Markov/MarkovChain.hs:38:32:
No instance for (Num [datatype])
arising from the 'deriving' clause of a data type declaration
Possible fix:
add an instance declaration for (Num [datatype])
or use a standalone 'deriving instance' declaration,
so you can specify the instance context yourself
When deriving the instance for (Monoid
(ChainGang order datatype prob))

src/HLearn/Models/Markov/MarkovChain.hs:38:39:
No instance for (Num [datatype])
arising from the 'deriving' clause of a data type declaration
Possible fix:
add an instance declaration for (Num [datatype])
or use a standalone 'deriving instance' declaration,
so you can specify the instance context yourself
When deriving the instance for (Group
(ChainGang order datatype prob))
Failed to install HLearn-markov-1.0.0
cabal: Error: some packages failed to install:
HLearn-markov-1.0.0 failed during the building phase. The exception was:
ExitFailure 1

cabal install failure

periodically checking HLearn out to see if it's buildable & usable yet :)

orb ➜  ~/projects/HLearn git:(373ec25) ✗ cabal install --only-dependencies --enable-optimization=2  --enable-shared -j --enable-tests && cabal configure --enable-tests --enable-optimization=2  --enable-shared  
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: HLearn-2.0.0.0 (user goal)
trying: base-4.8.0.0/installed-1b6... (dependency of HLearn-2.0.0.0)
trying: diagrams-lib-1.3 (dependency of HLearn-2.0.0.0)
trying: adjunctions-4.2.1 (dependency of diagrams-lib-1.3)
trying: semigroupoids-5.0.0.1 (dependency of adjunctions-4.2.1)
next goal: linear (dependency of diagrams-lib-1.3)
rejecting: linear-1.18.1, 1.18.0.1, 1.18 (conflict: semigroupoids==5.0.0.1,
linear => semigroupoids>=3 && <5)
rejecting: linear-1.17.1, 1.17 (conflict: base==4.8.0.0/installed-1b6...,
linear => base>=4.6 && <4.8)
rejecting: linear-1.16.4, 1.16.2, 1.16.1, 1.16, 1.15.5, 1.15.4 (conflict:
base==4.8.0.0/installed-1b6..., linear => base>=4.5 && <4.8)
rejecting: linear-1.15.3, 1.15.2, 1.15.1, 1.15.0.1 (conflict:
semigroupoids==5.0.0.1, linear => semigroupoids>=3 && <5)
rejecting: linear-1.15 (conflict: base==4.8.0.0/installed-1b6..., linear =>
base<0)
rejecting: linear-1.14.0.1, 1.14, 1.13, 1.12.1, 1.11.3 (conflict:
semigroupoids==5.0.0.1, linear => semigroupoids>=3 && <5)
rejecting: linear-1.11.2, 1.11.1, 1.11, 1.10.1.2, 1.10.1.1, 1.10.1, 1.10,
1.9.1, 1.9.0.1, 1.9, 1.8.1, 1.8, 1.7, 1.6, 1.4, 1.3.1.1, 1.3.1, 1.3, 1.2,
1.1.4, 1.1.2, 1.1.1, 1.0.1, 0.9.2, 0.9.1, 0.9, 0.8, 0.7, 0.6.1, 0.6, 0.5,
0.4.2.2, 0.4.2.1, 0.4.1, 0.2.0.2, 0.2 (conflict: diagrams-lib =>
linear>=1.11.3 && <1.19)
Dependency tree exhaustively searched.

Note: when using a sandbox, all packages are required to have consistent
dependencies. Try reinstalling/unregistering the offending packages or
recreating the sandbox.

this is on master~1 - have also tried master & the ghc7.10 branch.

Dependency error when installing through cabal

From what I can see the base dependencies contradict and rejects everything. What version of GHC is this meant to be installable on?

> ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.6.3
> cabal --version
cabal-install version 1.16.0.2
using version 1.16.0 of the Cabal library

Corrections to documentation

Specifying Gaussian types as :: Normal Double doesn't work for me, but :: Normal Double Double does.
Also, in the documentation on your website you use Gaussian instead of Normal. Why not make them synonymous to avoid confusion?

problem with cabal install

Hello I know HLearn from your blog, HLearn is really an exciting project. But I encount some problem when I try to install HLearn from cabal. My GHC version is: version 7.8.3. My operating system is Mac OSX 10.10.2. The following is the error message I get. Thanks a lot!
$ cabal install HLearn-algebra-0.0.1
Resolving dependencies...
Configuring HLearn-algebra-0.0.1...
Building HLearn-algebra-0.0.1...
Failed to install HLearn-algebra-0.0.1
Last 10 lines of the build log ( /Users/haihan/.cabal/logs/HLearn-algebra-0.0.1.log ):
[2 of 4] Compiling HLearn.Algebra.Functions ( src/HLearn/Algebra/Functions.hs, dist/build/HLearn/Algebra/Functions.o )

src/HLearn/Algebra/Functions.hs:42:7:
Not in scope: type constructor or class ‘CK.Partitionable’

src/HLearn/Algebra/Functions.hs:43:7:
Not in scope:
type constructor or class ‘CK.PartitionableConstraint’

src/HLearn/Algebra/Functions.hs:48:34: Not in scope: ‘CK.partition’
cabal: Error: some packages failed to install:
HLearn-algebra-0.0.1 failed during the building phase. The exception was:
ExitFailure 1

Dist file is checked in

Probably unintentionally.

git rm --cached dist/build/autogen/Paths_HLearn_distributions.hs

Interested in working on HLearn

Please email me at the address listed on my (out of date - but perhaps that's a redundant qualifier) academic page: [ https://math.berkeley.edu/~ksjames/ ]. It'd be a weekend project for me but it's worth a discussion at least

Cabal install failure

I executed cabal undate and cabal install HLearn-algebra but it keeps trying to install ConstraintKinds-1.1.0.0 which always fails. This is strange since in the repository it asks for >=1.2.0 .

Naive Bayes classifier

I wanted to do Bayesian classification with HLearn, but it is no longer here.

I found #59 which gives a bit of background, but it doesn't solve my problem :) So, where do things stand now? Anything we can do to resurrect NBC and other classifiers from hlearn-classification?

Build on Ubuntu 14.04 failing at assembler stage

I don't have time to dig in ATM, but there's an error:

[1 of 2] Compiling Paths_HLearn     ( .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/autogen/Paths_HLearn.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/hlearn-allknn/hlearn-allknn-tmp/Paths_HLearn.o )
/tmp/ghc2498_0/ghc_6.s: Assembler messages:

/tmp/ghc2498_0/ghc_6.s:117:0:
     Error: can't resolve `.rodata' {.rodata section} - `PathszuHLearn_getLibDir4_info$def' {.text section}

/tmp/ghc2498_0/ghc_6.s:163:0:
     Error: can't resolve `.rodata' {.rodata section} - `PathszuHLearn_getLibDir2_info$def' {.text section}

/tmp/ghc2498_0/ghc_6.s:183:0:
 ...

Let me know if a more verbose trace would be helpful. I've personally had issues like this when the cabal file failed to reference a file that was nevertheless silently compiled, just a guess.

hlearn-distributions depends on constrainkinds-1.1.0.0 which fails to install

Hi, I am on a mac using ghc 7.10. I am trying to install hlearn-distributions which depends on constrainkinds-1.1.0.0 which gives the following error on installation.

$ cabal install constraintkinds
Resolving dependencies...
Configuring ConstraintKinds-1.1.0.0...
Building ConstraintKinds-1.1.0.0...
Failed to install ConstraintKinds-1.1.0.0
Build log ( /Users/ankitku/.cabal/logs/ConstraintKinds-1.1.0.0.log ):
Configuring ConstraintKinds-1.1.0.0...
Building ConstraintKinds-1.1.0.0...
Preprocessing library ConstraintKinds-1.1.0.0...
[1 of 9] Compiling Control.ConstraintKinds.Partitionable ( src/Control/ConstraintKinds/Partitionable.hs, dist/build/Control/ConstraintKinds/Partitionable.o )
[2 of 9] Compiling Control.ConstraintKinds.Functor ( src/Control/ConstraintKinds/Functor.hs, dist/build/Control/ConstraintKinds/Functor.o )
[3 of 9] Compiling Control.ConstraintKinds.Pointed ( src/Control/ConstraintKinds/Pointed.hs, dist/build/Control/ConstraintKinds/Pointed.o )
[4 of 9] Compiling Control.ConstraintKinds.Foldable ( src/Control/ConstraintKinds/Foldable.hs, dist/build/Control/ConstraintKinds/Foldable.o )

src/Control/ConstraintKinds/Foldable.hs:58:10:
    Ambiguous occurrence ‘Foldable’
    It could refer to either ‘Control.ConstraintKinds.Foldable.Foldable’,
                             defined at src/Control/ConstraintKinds/Foldable.hs:26:1
                          or ‘P.Foldable’,
                             imported from ‘Prelude’ at src/Control/ConstraintKinds/Foldable.hs:20:1-36
                             (and originally defined in ‘Data.Foldable’)

src/Control/ConstraintKinds/Foldable.hs:76:10:
    Ambiguous occurrence ‘Foldable’
    It could refer to either ‘Control.ConstraintKinds.Foldable.Foldable’,
                             defined at src/Control/ConstraintKinds/Foldable.hs:26:1
                          or ‘P.Foldable’,
                             imported from ‘Prelude’ at src/Control/ConstraintKinds/Foldable.hs:20:1-36
                             (and originally defined in ‘Data.Foldable’)

src/Control/ConstraintKinds/Foldable.hs:90:10:
    Ambiguous occurrence ‘Foldable’
    It could refer to either ‘Control.ConstraintKinds.Foldable.Foldable’,
                             defined at src/Control/ConstraintKinds/Foldable.hs:26:1
                          or ‘P.Foldable’,
                             imported from ‘Prelude’ at src/Control/ConstraintKinds/Foldable.hs:20:1-36
                             (and originally defined in ‘Data.Foldable’)

src/Control/ConstraintKinds/Foldable.hs:105:10:
    Ambiguous occurrence ‘Foldable’
    It could refer to either ‘Control.ConstraintKinds.Foldable.Foldable’,
                             defined at src/Control/ConstraintKinds/Foldable.hs:26:1
                          or ‘P.Foldable’,
                             imported from ‘Prelude’ at src/Control/ConstraintKinds/Foldable.hs:20:1-36
                             (and originally defined in ‘Data.Foldable’)
cabal: Error: some packages failed to install:
ConstraintKinds-1.1.0.0 failed during the building phase. The exception was:
ExitFailure 1

HLearn.History

I was thinking of tackling a FIXME surrounding incorporation of History.Timing into the History modue. Here's a few initial thoughts and ideas.

API & HistoryT

report is the main (and only) access to the History machinery.

I'd like to include an ability to be selective in what's timed, and quickly turn an IO chunk say, into a History chunk (by adding report to a line and liftIOing other stuff). Say we have:

sumOrig = do
 let s1 = P.foldr (P.+) 0 [1..10000]
 threadDelay 1000000
 return s1

becoming

liftIO' = History . liftIO

sumHist = do
 s1 <- report $ P.foldr (P.+) 0 [1..10000]
 liftIO' $ threadDelay 1000000
 return s1

Which all seems doable and very cool. At this point, however, I jump straight to thinking about a HistoryT, so the report api can handle an IO a etc, but I lack a MonadIO to throw in there.

So question number 1 is whether to give up on a HistoryT given no MonadIO etc, or whether that would be a simple compatability patch.

Relationship to Criterion

I do a lot of benchmarking and the guts of criterion has the wrong types for stuff I often want to do (quickly annotate computations with debugging and timing information, rather than do statistical analytics of multiple runs without any continuation that criterion is based on)

I often pick apart times into GC and Mutation via some criterion functionality. I also think it would benefit the History monad if you could start and stop the timing within a report chunk, but still be able to report timings at higher levels. The report API could morph to something like this:

report "all of it" $ do
 s1 <- report "the slow bit" $ P.foldr (P.+) 0 [1..10000]
 liftIO' $ threadDelay 1000000
 return s1

SubHask versus Control.Monad

Being able to benchmark in the middle of a computation is a nice goal in the broader Haskell toolkit (there might be stuff out there that already does this, but I haven't come across it).
I'm unsure whether to head for a more general History (or HistoryT) based on Control.Monad or stick to SubHask.

My use case, however, is pretty centered on HLearn, so targetting a boiler-plate monad may not get the job done.

Very generally, to what extent can normal monads play nice with subhask?

Reportable versus Optimizable

History.Timing (one off reporting) is starting to drift away from the idea of reporting on optimization (or other) loopings. There might be a case for clear separation of looping constructs like stopping criteria versus straight reporting constructs (like when to report timings).
I haven't dug into how History is used in a looping context yet.

I'm sure there's lots of other issues I haven't thought of yet.

Tony

Unnecessary Definition of HList and HVector?

HLearn imports vector-heterogenous, which has an HList and HVector declaration. However, HLearn also defines HList and HVector within itself. Is there a reason for this, or can (/ should) I get rid of the internal implementations?

Docs: type instance should be just type

http://hackage.haskell.org/packages/archive/HLearn-distributions/1.0.0.1/doc/html/HLearn-Models-Distributions-Multivariate-Internal-TypeLens.html

The entries

instance TypeLens TH_name where
    type TypeLensIndex TH_name = Nat1Box Zero
instance TypeLens TH_species where
    type TypeLensIndex TH_species = Nat1Box (Succ Zero)
...

are invalid syntax. It should be

instance TypeLens TH_name where
    type TypeLensIndex TH_name = Nat1Box Zero
instance TypeLens TH_species where
    type TypeLensIndex TH_species = Nat1Box (Succ Zero)
...

Unfortunately, that output is also wrong in ghc -ddump-splices.

I've also written a post to Haskell-Cafe on this.

Build issues.

Hi,
I am trying to build this project (master branch). I am on ghc 7.10.
I am using sandbox, and I think there is no issues with installation.
While building I get these errors
Can anybody please help.

/tmp/ghc28604_0/ghc_6.s: Assembler messages:

/tmp/ghc28604_0/ghc_6.s:117:0:
     Error: can't resolve `.rodata' {.rodata section} - `PathszuHLearn_getLibDir4_info$def' {.text section}

/tmp/ghc28604_0/ghc_6.s:163:0:
     Error: can't resolve `.rodata' {.rodata section} - `PathszuHLearn_getLibDir2_info$def' {.text section}

/tmp/ghc28604_0/ghc_6.s:183:0:
     Error: can't resolve `.rodata' {.rodata section} - `PathszuHLearn_getLibDir1_info$def' {.text section}

/tmp/ghc28604_0/ghc_6.s:203:0:
     Error: can't resolve `.rodata' {.rodata section} - `PathszuHLearn_getLibDir_info$def' {.text section}

/tmp/ghc28604_0/ghc_6.s:249:0:
     Error: can't resolve `.rodata' {.rodata section} - `PathszuHLearn_getDataDir4_info$def' {.text section}

/tmp/ghc28604_0/ghc_6.s:295:0:
     Error: can't resolve `.rodata' {.rodata section} - `PathszuHLearn_getDataDir2_info$def' {.text section}

/tmp/ghc28604_0/ghc_6.s:315:0:
     Error: can't resolve `.rodata' {.rodata section} - `PathszuHLearn_getDataDir1_info$def' {.text section}

/tmp/ghc28604_0/ghc_6.s:335:0:
     Error: can't resolve `.rodata' {.rodata section} - `PathszuHLearn_getDataDir_info$def' {.text section}

/tmp/ghc28604_0/ghc_6.s:362:0:
     Error: can't resolve `.rodata' {.rodata section} - `PathszuHLearn_getDataFileName1_info$def' {.text section}

/tmp/ghc28604_0/ghc_6.s:382:0:
     Error: can't resolve `.rodata' {.rodata section} - `PathszuHLearn_getDataFileName_info$def' {.text section}

/tmp/ghc28604_0/ghc_6.s:428:0:
     Error: can't resolve `.rodata' {.rodata section} - `PathszuHLearn_getLibexecDir4_info$def' {.text section}

/tmp/ghc28604_0/ghc_6.s:474:0:
     Error: can't resolve `.rodata' {.rodata section} - `PathszuHLearn_getLibexecDir2_info$def' {.text section}

/tmp/ghc28604_0/ghc_6.s:494:0:
     Error: can't resolve `.rodata' {.rodata section} - `PathszuHLearn_getLibexecDir1_info$def' {.text section}

/tmp/ghc28604_0/ghc_6.s:514:0:
     Error: can't resolve `.rodata' {.rodata section} - `PathszuHLearn_getLibexecDir_info$def' {.text section}

/tmp/ghc28604_0/ghc_6.s:560:0:
     Error: can't resolve `.rodata' {.rodata section} - `PathszuHLearn_getSysconfDir4_info$def' {.text section}

/tmp/ghc28604_0/ghc_6.s:606:0:
     Error: can't resolve `.rodata' {.rodata section} - `PathszuHLearn_getSysconfDir2_info$def' {.text section}

/tmp/ghc28604_0/ghc_6.s:626:0:
     Error: can't resolve `.rodata' {.rodata section} - `PathszuHLearn_getSysconfDir1_info$def' {.text section}

/tmp/ghc28604_0/ghc_6.s:646:0:
     Error: can't resolve `.rodata' {.rodata section} - `PathszuHLearn_getSysconfDir_info$def' {.text section}

/tmp/ghc28604_0/ghc_6.s:692:0:
     Error: can't resolve `.rodata' {.rodata section} - `PathszuHLearn_getBinDir4_info$def' {.text section}

/tmp/ghc28604_0/ghc_6.s:738:0:
     Error: can't resolve `.rodata' {.rodata section} - `PathszuHLearn_getBinDir2_info$def' {.text section}

/tmp/ghc28604_0/ghc_6.s:758:0:
     Error: can't resolve `.rodata' {.rodata section} - `PathszuHLearn_getBinDir1_info$def' {.text section}

/tmp/ghc28604_0/ghc_6.s:778:0:
     Error: can't resolve `.rodata' {.rodata section} - `PathszuHLearn_getBinDir_info$def' {.text section}

hlearn depends on a version of hmatrix that isn't available on hackage

HLearn looks for version 0.15.2.2 but only 0.15.2.1 (and the 0.16 branch) are available on hackage – is there somewhere this package should be coming from, and if not, is there a reason HLearn isn't using 0.15.2.1 or 0.16?

0.16 breaks HLearn (duplicate instance declarations since hmatrix 0.16 has instance (Container Vector t, Eq t, Num (Vector t), Product t) => Monoid (Matrix t)) but 0.15.2.1 seems to work.

Perceptron example doesn't compile

I'm looking for a simple example of how to use one of the classifiers, and found the spam classification perceptron. I followed the README but it fails to compile, because class HasRing isn't defined anywhere:

cd $soft/HLearn/examples/spam_classification
ghc --make perceptron.hs

[1 of 1] Compiling Main             ( perceptron.hs, perceptron.o )

perceptron.hs:38:10:
    Not in scope: type constructor or class ‘HasRing’

I assume because it's out of date - are there any updated examples?

Helping out?

I'd be interested in helping out with this. At this point, I'm probably best suited to simpler tasks like the person from #70. Do you have any low hanging fruit on your wishlist, either here or in subhask?

Is HLearn intentionally kept of hackage / stackage?

I am interested in using HLearn in a Haskell command line tool, but having it not available on hackage / stackage (unless I am mistaken) complicates this a bit. Is this intentional and likely to stay this way?

x is not a convenient name to be exported

I have not seen Haskell code that does not call some variable x somewhere :P

This gives name shadowing or Ambiguous occurrence 'x' errors.

It is exported HLearn.Models.Classifiers (via HLearn.Models.Regression.PowerLaw, Coord record).

Maybe it could be called coordX?

I'm also not sure if HLearn.Models.Classifiers should re-export everything all the way down.

Can I use variable-length things as data points?

I have a boolean classification problem where the input features consist of 200 doubles.

Can I have a datapoint like

data Point = Point
  { _label :: Bool
  , _features :: [Double]
  } 

or are all HLearn datapoints required to be explicitly listed in the record?

(I know that the features will always have a given length - the problem is that I want to avoid writing a length 200 record.)

In case this is supported, how would I type a classifier for this, e.g.

type NB = Bayes TH_label (Multivariate Point
                            '[ MultiCategorical   '[Output]
                             , Independent Normal '[ ??? all the _features ]
                             ]
                             Double
                          )

Thank you!

Sanity checks for bad input values

I just played around with the sex classification example (by the way, using HLearn I discovered that there are wrong values values on Wikipedia :/), and silently messed up the classification:

I commented out some input values and only those males with equal shoe size. This caused the variance to become 0 (since if all values are the same, there is no variance), and Normal distributions with variance 0 are invalid (they don't sum up to 1). Thus, all my male probabilities became NaN; I had not noticed had I only used classify, only my use of probabilityClassify made it visible.

Would it be possible to add some convenience sanity check functions to HLearn that check the necessary invariants, e.g. that inputs must not have variance 0?

Thanks, and great job with this library!

Stack support

RIght now in order to include HLearn in my project I have to list many packages inside stack.yaml file to meet all its dependencies, this creates custom sandbox and kinda annoying. Would be great if HLearn could be build against some stackage snapshot, lts-3.0 for example.

getMargin for Dependent MultiNormal?

Is it possible to marginalize a variable which is part of a dependent multi-normal distribution? Not sure if that is the right terminology, I'm new to machine learning.

I basically have this:

data MyData = MyData
    { _foo :: String
    , _bar :: String
    , _fooN :: Double
    , _barN :: Double
    }

type MyDist = Multivariate MyData
    '[ MultiCategorical '[String, String]
     , Dependent MultiNormal '[Double, Double]
     ]
     Double

And I get a type error when I try to do this:

-- dist :: MyDist
getMargin TH_fooN $ condition TH_foo "foo" $ condition TH_bar "bar" dist

Am I supposed to be able to do that or is there another way I can sample the distribution? Ideally I want to get a tuple with the value for fooN and barN together given the specified conditions.

Interested in contributing - Bayesian Classifier?

Hey Mike,

I'm interested in contributing as a fun exercise for my ML and Haskell chops. A disclaimer: I don't have a strong background in machine learning implementations and I haven't been writing Haskell for more than a few months. However, I'm willing to work hard, read papers and learn the ropes.

It looks like HLearn is currently lacking a Naive Bayesian Classifier implementation - do you think that would make a good initial project?

Cheers,
T

Adding neural networks to HLearn

Hi,
I have been working (on and off) on a port in Haskell of Google's word2vec, first out of fun and then lately out of professional interest. My code is rather rudimentary and is here: https://github.com/abailly/hs-word2vec

It kinda works, at least in the sense it outputs something (a model, PCA data, SVG graphics) but I am running into my lack of real knowledge of neural networks in particular, and machine learning in general. I would like to cooperate with other people in order to:

  • improve that code to the point it is usable,
  • increase my knowledge and understanding of ML techniques and tools to the point I can put HLearn (or others) at use in my day to day work,
  • make it efficient using parallelization tools available in Haskell.

Is this something that might be interest to this project? Is my code some interesting starting point or I should just erase it and restart from scratch using other tools/techniques?

Thanks for your help,

Compile issue with branch dev-7.8

I'm struggling to get HLearn working on my Mac. Installing via hackage gives Constraintkind errors, so I'm trying to install from source using branch dev-7.8. I get the error below. Any ideas?

Building HLearn-2.0.0.0...
Preprocessing library HLearn-2.0.0.0...
[13 of 68] Compiling HLearn.DataStructures.StrictList ( src/HLearn/DataStructures/StrictList.hs, dist/build/HLearn/DataStructures/StrictList.o )

src/HLearn/DataStructures/StrictList.hs:59:10: Warning:
‘List’ is an instance of Monad but not Applicative - this will become an error in GHC 7.10, under the Applicative-Monad Proposal.
[14 of 68] Compiling HLearn.Algebra.Structures.CanError ( src/HLearn/Algebra/Structures/CanError.hs, dist/build/HLearn/Algebra/Structures/CanError.o )
[18 of 68] Compiling HLearn.Algebra.History ( src/HLearn/Algebra/History.hs, dist/build/HLearn/Algebra/History.o )

src/HLearn/Algebra/History.hs:71:10: Warning:
‘LazyIO’ is an instance of Monad but not Applicative - this will become an error in GHC 7.10, under the Applicative-Monad Proposal.
[19 of 68] Compiling HLearn.Algebra.LinearAlgebra ( src/HLearn/Algebra/LinearAlgebra.hs, dist/build/HLearn/Algebra/LinearAlgebra.o )

src/HLearn/Algebra/LinearAlgebra.hs:306:10:
Duplicate instance declarations:
instance LA.Field a => Monoid (LA.Matrix a)
-- Defined at src/HLearn/Algebra/LinearAlgebra.hs:306:10
instance (LA.Container LA.Vector t, Eq t, Num (LA.Vector t),
LA.Product t) =>
Monoid (LA.Matrix t)
-- Defined in ‘hmatrix-0.16.0.4:Numeric.Matrix’
Failed to install HLearn-2.0.0.0
cabal: Error: some packages failed to install:
HLearn-2.0.0.0 failed during the building phase. The exception was:
ExitFailure 1

hlearn-allknn can't be built because `shuffle` function can't be found

When trying to build HLearn from master (b32ff13), it is falling when trying to build the hlearn-allknn binary:

Building HLearn-2.0.0.0...
Preprocessing library HLearn-2.0.0.0...
[ 1 of 13] Compiling HLearn.Data.SpaceTree.CoverTree.Unsafe ( src/HLearn/Data/SpaceTree/CoverTree/Unsafe.hs, dist/build/HLearn/Data/SpaceTree/CoverTree/Unsafe.o )
[ 2 of 13] Compiling HLearn.Models.Distributions ( src/HLearn/Models/Distributions.hs, dist/build/HLearn/Models/Distributions.o )

src/HLearn/Models/Distributions.hs:72:10: Warning:
    No explicit implementation for
      ‘ones’
    In the instance declaration for ‘FreeModule (Moments v)’
[ 3 of 13] Compiling HLearn.Data.SpaceTree ( src/HLearn/Data/SpaceTree.hs, dist/build/HLearn/Data/SpaceTree.o )
[ 4 of 13] Compiling HLearn.Data.SpaceTree.Algorithms ( src/HLearn/Data/SpaceTree/Algorithms.hs, dist/build/HLearn/Data/SpaceTree/Algorithms.o )
[ 5 of 13] Compiling HLearn.Data.SpaceTree.Algorithms_Specialized ( src/HLearn/Data/SpaceTree/Algorithms_Specialized.hs, dist/build/HLearn/Data/SpaceTree/Algorithms_Specialized.o )
[ 6 of 13] Compiling HLearn.Data.SpaceTree.CoverTree ( src/HLearn/Data/SpaceTree/CoverTree.hs, dist/build/HLearn/Data/SpaceTree/CoverTree.o )
[ 7 of 13] Compiling HLearn.Data.SpaceTree.CoverTree_Specialized ( src/HLearn/Data/SpaceTree/CoverTree_Specialized.hs, dist/build/HLearn/Data/SpaceTree/CoverTree_Specialized.o )
[ 8 of 13] Compiling HLearn.History.Timing ( src/HLearn/History/Timing.hs, dist/build/HLearn/History/Timing.o )
[ 9 of 13] Compiling HLearn.Data.LoadData ( src/HLearn/Data/LoadData.hs, dist/build/HLearn/Data/LoadData.o )
[10 of 13] Compiling HLearn.History   ( src/HLearn/History.hs, dist/build/HLearn/History.o )
[11 of 13] Compiling HLearn.Optimization.Univariate ( src/HLearn/Optimization/Univariate.hs, dist/build/HLearn/Optimization/Univariate.o )
[12 of 13] Compiling HLearn.Optimization.Multivariate ( src/HLearn/Optimization/Multivariate.hs, dist/build/HLearn/Optimization/Multivariate.o )
[13 of 13] Compiling HLearn.Classifiers.Linear ( src/HLearn/Classifiers/Linear.hs, dist/build/HLearn/Classifiers/Linear.o )
In-place registering HLearn-2.0.0.0...
Preprocessing executable 'hlearn-allknn' for HLearn-2.0.0.0...
[1 of 2] Compiling Paths_HLearn     ( dist/build/autogen/Paths_HLearn.hs, dist/build/hlearn-allknn/hlearn-allknn-tmp/Paths_HLearn.o )
[2 of 2] Compiling Main             ( executables/hlearn-allknn/Main.hs, dist/build/hlearn-allknn/hlearn-allknn-tmp/Main.o )

executables/hlearn-allknn/Main.hs:352:34: Not in scope: ‘shuffle’

shuffle appears to be defined in src/HLearn/Evaluation/CrossValidation.hs, but CrossValidation.hs is commented out in the "exposed-modules:" section of the HLearn.cabal file:

Library
    Build-Depends:
        -- common dependencies
        base                >= 4.8 && <4.9,
        subhask             >= 0.1,

        -- control
        mtl                 >= 2.1.2,

        -- i/o
        ansi-terminal       >= 0.6.1.1,
        directory           >= 1.2,
        time                >= 1.4.2

        -- visualization
--         diagrams-svg        >= 0.6,
--         diagrams-lib        >= 1.3,
--         process             >= 1.1
--         graphviz            >= 2999.16

    hs-source-dirs:
        src

    Exposed-modules:

        HLearn.History
        HLearn.History.Timing

--         HLearn.Data.Graph
--         HLearn.Data.Image
        HLearn.Data.LoadData
        HLearn.Data.SpaceTree
        HLearn.Data.SpaceTree.CoverTree
        HLearn.Data.SpaceTree.CoverTree_Specialized
        HLearn.Data.SpaceTree.CoverTree.Unsafe
        HLearn.Data.SpaceTree.Algorithms
        HLearn.Data.SpaceTree.Algorithms_Specialized

--         HLearn.Evaluation.CrossValidation

        HLearn.Classifiers.Linear
        HLearn.Models.Distributions

        HLearn.Optimization.Multivariate
        HLearn.Optimization.Univariate

--         HLearn.Optimization.Amoeba
--         HLearn.Optimization.Conic
--         HLearn.Optimization.StepSize
--         HLearn.Optimization.StochasticGradientDescent
--         HLearn.Optimization.StepSize.Linear
--         HLearn.Optimization.StepSize.Const
--         HLearn.Optimization.StepSize.AlmeidaLanglois

    Other-modules:

    Extensions:
        FlexibleInstances
...

Some of the tests seem to make use of hlearn-allknn, so they are failing as well.

HList errors

HList.hs 118:5
'typeOf' is not a (visible) method of class Typeable
HList.hs 288:1
Kind variable is also used as a type variable: 'a'
In the declaration for type family: $

ghc-7.8.4
x86_64
cabal-1.22.2.0
nixos-14.12

Interested in working on HLearn.

@mikeizbicki I am interested in working on HLearn. I have basic knowledge of machine learning and haskell. I am willing to start my contribution even from documentation. So please provide some direction.

HLearn-classification install trouble

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

Compilation error when building HLearn-distributions

(found similar report here (see the last comment): http://izbicki.me/blog/markov-networks-monoids-and-futurama)

(also see the proposed solution below)

src/HLearn/Models/Distributions/Univariate/Internal/Moments.hs:32:1:
basicUnsafeFreeze’ is not a (visible) method of classData.Vector.Generic.Base.Vector’

src/HLearn/Models/Distributions/Univariate/Internal/Moments.hs:32:1:
basicUnsafeThaw’ is not a (visible) method of classData.Vector.Generic.Base.Vector’

src/HLearn/Models/Distributions/Univariate/Internal/Moments.hs:32:1:
basicLength’ is not a (visible) method of classData.Vector.Generic.Base.Vector’

src/HLearn/Models/Distributions/Univariate/Internal/Moments.hs:32:1:
basicUnsafeSlice’ is not a (visible) method of classData.Vector.Generic.Base.Vector’

src/HLearn/Models/Distributions/Univariate/Internal/Moments.hs:32:1:
basicUnsafeIndexM’ is not a (visible) method of classData.Vector.Generic.Base.Vector’

src/HLearn/Models/Distributions/Univariate/Internal/Moments.hs:32:1:
basicUnsafeCopy’ is not a (visible) method of classData.Vector.Generic.Base.Vector’

src/HLearn/Models/Distributions/Univariate/Internal/Moments.hs:32:1:
elemseq’ is not a (visible) method of classData.Vector.Generic.Base.Vector’

src/HLearn/Models/Distributions/Univariate/Internal/Moments.hs:32:1:
basicUnsafeFreeze’ is not a (visible) method of classData.Vector.Generic.Base.Vector’

src/HLearn/Models/Distributions/Univariate/Internal/Moments.hs:32:1:
basicUnsafeThaw’ is not a (visible) method of classData.Vector.Generic.Base.Vector’

src/HLearn/Models/Distributions/Univariate/Internal/Moments.hs:32:1:
basicLength’ is not a (visible) method of classData.Vector.Generic.Base.Vector’

src/HLearn/Models/Distributions/Univariate/Internal/Moments.hs:32:1:
basicUnsafeSlice’ is not a (visible) method of classData.Vector.Generic.Base.Vector’

src/HLearn/Models/Distributions/Univariate/Internal/Moments.hs:32:1:
basicUnsafeIndexM’ is not a (visible) method of classData.Vector.Generic.Base.Vector’

src/HLearn/Models/Distributions/Univariate/Internal/Moments.hs:32:1:
basicUnsafeCopy’ is not a (visible) method of classData.Vector.Generic.Base.Vector’

src/HLearn/Models/Distributions/Univariate/Internal/Moments.hs:32:1:
elemseq’ is not a (visible) method of classData.Vector.Generic.Base.Vector’

src/HLearn/Models/Distributions/Univariate/Internal/Moments.hs:32:1:
basicLength’ is not a (visible) method of classData.Vector.Generic.Mutable.MVector’

src/HLearn/Models/Distributions/Univariate/Internal/Moments.hs:32:1:
basicUnsafeSlice’ is not a (visible) method of classData.Vector.Generic.Mutable.MVector’

src/HLearn/Models/Distributions/Univariate/Internal/Moments.hs:32:1:
basicOverlaps’ is not a (visible) method of classData.Vector.Generic.Mutable.MVector’

src/HLearn/Models/Distributions/Univariate/Internal/Moments.hs:32:1:
basicUnsafeNew’ is not a (visible) method of classData.Vector.Generic.Mutable.MVector’

src/HLearn/Models/Distributions/Univariate/Internal/Moments.hs:32:1:
basicUnsafeReplicate’ is not a (visible) method of classData.Vector.Generic.Mutable.MVector’

src/HLearn/Models/Distributions/Univariate/Internal/Moments.hs:32:1:
basicUnsafeRead’ is not a (visible) method of classData.Vector.Generic.Mutable.MVector’

src/HLearn/Models/Distributions/Univariate/Internal/Moments.hs:32:1:
basicUnsafeWrite’ is not a (visible) method of classData.Vector.Generic.Mutable.MVector’

src/HLearn/Models/Distributions/Univariate/Internal/Moments.hs:32:1:
basicClear’ is not a (visible) method of classData.Vector.Generic.Mutable.MVector’

src/HLearn/Models/Distributions/Univariate/Internal/Moments.hs:32:1:
basicSet’ is not a (visible) method of classData.Vector.Generic.Mutable.MVector’

src/HLearn/Models/Distributions/Univariate/Internal/Moments.hs:32:1:
basicUnsafeCopy’ is not a (visible) method of classData.Vector.Generic.Mutable.MVector’

src/HLearn/Models/Distributions/Univariate/Internal/Moments.hs:32:1:
basicUnsafeMove’ is not a (visible) method of classData.Vector.Generic.Mutable.MVector’

src/HLearn/Models/Distributions/Univariate/Internal/Moments.hs:32:1:
basicUnsafeGrow’ is not a (visible) method of classData.Vector.Generic.Mutable.MVector’

src/HLearn/Models/Distributions/Univariate/Internal/Moments.hs:32:1:
basicLength’ is not a (visible) method of classData.Vector.Generic.Mutable.MVector’

src/HLearn/Models/Distributions/Univariate/Internal/Moments.hs:32:1:
basicUnsafeSlice’ is not a (visible) method of classData.Vector.Generic.Mutable.MVector’

src/HLearn/Models/Distributions/Univariate/Internal/Moments.hs:32:1:
basicOverlaps’ is not a (visible) method of classData.Vector.Generic.Mutable.MVector’

src/HLearn/Models/Distributions/Univariate/Internal/Moments.hs:32:1:
basicUnsafeNew’ is not a (visible) method of classData.Vector.Generic.Mutable.MVector’

src/HLearn/Models/Distributions/Univariate/Internal/Moments.hs:32:1:
basicUnsafeReplicate’ is not a (visible) method of classData.Vector.Generic.Mutable.MVector’

src/HLearn/Models/Distributions/Univariate/Internal/Moments.hs:32:1:
basicUnsafeRead’ is not a (visible) method of classData.Vector.Generic.Mutable.MVector’

src/HLearn/Models/Distributions/Univariate/Internal/Moments.hs:32:1:
basicUnsafeWrite’ is not a (visible) method of classData.Vector.Generic.Mutable.MVector’

src/HLearn/Models/Distributions/Univariate/Internal/Moments.hs:32:1:
basicClear’ is not a (visible) method of classData.Vector.Generic.Mutable.MVector’

src/HLearn/Models/Distributions/Univariate/Internal/Moments.hs:32:1:
basicSet’ is not a (visible) method of classData.Vector.Generic.Mutable.MVector’

src/HLearn/Models/Distributions/Univariate/Internal/Moments.hs:32:1:
basicUnsafeCopy’ is not a (visible) method of classData.Vector.Generic.Mutable.MVector’

src/HLearn/Models/Distributions/Univariate/Internal/Moments.hs:32:1:
basicUnsafeMove’ is not a (visible) method of classData.Vector.Generic.Mutable.MVector’

src/HLearn/Models/Distributions/Univariate/Internal/Moments.hs:32:1:
basicUnsafeGrow’ is not a (visible) method of classData.Vector.Generic.Mutable.MVector’
Failed to install HLearn-distributions-1.1.0.1

Proposed solution:
The problem occurs on mavericks OSX (haven't tried others) on the latest relased version of the package = 1.1.0.1 (it seems that the file looks different on current master)
Looks like bos had similar problem and solved it this way: haskell/math-functions@ace6a55

I tried this and added the following two lines to src/HLearn/Models/Distributions/Univariate/Internal/Moments.hs

import Data.Vector.Generic (Vector(..))
import Data.Vector.Generic.Mutable (MVector(..))

and that suppressed the errors

A couple of questions

I'm working on a tutorial about machine learning and my intention is to use HLearn in the tutorial (there are not so many options).

A few things I would like to ask:

  • Is it possible to release HLearn on Hackage? What industrial users should prefer: building from repo or deprecated packages that are released on Hackage (I would not deprecate them until there is something to use instead…).
  • Once we have HLearn on Hackage, consider adding it to Stackage too. Stackage is very popular nowadays and it solves numerous problems with building process. When you use the stack tool in combination with Stackage snapshots you get reproducible builds — a nice thing, no more pain with building!
  • Is there some sort of comprehensive tutorial? I see you have some blog posts about the library, is this everything that is available? What I'm talking about is practical guides that average programmer can understand, not papers.

ConstraintKinds-1.3.0

The algebra package should enforce ConstraintKinds < 1.3.0 because it doesn't have Partition or something

Invalid subhask submodule

I can't clone master on this repository:

$ git clone --recursive https://github.com/mikeizbicki/HLearn
Cloning into 'HLearn'...
remote: Counting objects: 7143, done.
remote: Total 7143 (delta 0), reused 0 (delta 0), pack-reused 7143
Receiving objects: 100% (7143/7143), 16.56 MiB | 6.87 MiB/s, done.
Resolving deltas: 100% (3392/3392), done.
Checking connectivity... done.
Submodule 'datasets' (https://github.com/mikeizbicki/datasets.git) registered for path 'datasets'
Submodule 'subhask' (https://github.com/mikeizbicki/subhask.git) registered for path 'subhask'
Cloning into 'datasets'...
remote: Counting objects: 59507, done.
remote: Compressing objects: 100% (46412/46412), done.
remote: Total 59507 (delta 13085), reused 59507 (delta 13085), pack-reused 0
Receiving objects: 100% (59507/59507), 309.19 MiB | 26.63 MiB/s, done.
Resolving deltas: 100% (13085/13085), done.
Checking connectivity... done.
Submodule path 'datasets': checked out 'ea5a06d19c62de8bf28a43b2c948a011fd896fda'
Cloning into 'subhask'...
remote: Counting objects: 1492, done.
remote: Total 1492 (delta 0), reused 0 (delta 0), pack-reused 1492
Receiving objects: 100% (1492/1492), 723.94 KiB | 0 bytes/s, done.
Resolving deltas: 100% (910/910), done.
Checking connectivity... done.
fatal: reference is not a tree: 7cc8aaf689bfa99eabe1c71db55a8f1815d7eb24
Unable to checkout '7cc8aaf689bfa99eabe1c71db55a8f1815d7eb24' in submodule path 'subhask'

Cabal build failure

I just tried installing HLearn-classifiers-1.0.1.1 in a clean cabal-dev sand box, on GHC 7.6.3. I got a compile error:

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

Compile error of HLearn-classification

I see this compile error when installing HLearn-classification-1.0.1.1.
My environment is GHC 7.6.3 with HP 2013.2 on Mac OSX 10.9.

I'm very interested in this HLearn library, and thanks for your help!

Downloading HLearn-classification-1.0.1.1...
Configuring HLearn-classification-1.0.1.1...
Building HLearn-classification-1.0.1.1...
Preprocessing library HLearn-classification-1.0.1.1...
[ 1 of 11] Compiling HLearn.Models.Classifiers.Centroid ( src/HLearn/Models/Classifiers/Centroid.hs, dist/build/HLearn/Models/Classifiers/Centroid.o )
[ 2 of 11] Compiling HLearn.Models.Classifiers.Common ( src/HLearn/Models/Classifiers/Common.hs, dist/build/HLearn/Models/Classifiers/Common.o )
[ 3 of 11] Compiling HLearn.Models.Classifiers.Bayes ( src/HLearn/Models/Classifiers/Bayes.hs, dist/build/HLearn/Models/Classifiers/Bayes.o )

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

no instance (Classifier (Perceptron Bool Vector2)) error

The example perceptron.hs in HLearn/HLearn-classification/src/examples/perceptron.hs seems to be broken.

When I run the example, it gives me an error --

    No instance for (Classifier (Perceptron Bool Vector2))
  arising from a use of `classify'
Possible fix:
  add an instance declaration for
  (Classifier (Perceptron Bool Vector2))
In the second argument of `(.)', namely `classify p'
In the first argument of `map', namely `(letter . classify p)'
In the first argument of `map', namely
  `(map (letter . classify p))'

The error is a little hard to understand. If someone can guide me a little, I would like to correct the bug and initiate a pull request...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.