FactorAnalysis, KernelPCA in MultivariateStats.jl broken?

It seems like some dimensionality reduction methods in MultivariateStats.jl are broken.
I tried the sample code given in the documentation:

# train a FactorAnalysis model
M22 = fit(FactorAnalysis, Xtr; maxoutdim=100)

UndefVarError: FactorAnalysis not defined
include_string(::String, ::String) at loading.jl:522
include_string(::String, ::String, ::Int64) at eval.jl:30
include_string(::Module, ::String, ::String, ::Int64, ::Vararg{Int64,N} where N) at eval.jl:34
(::Atom.##100#105{String,Int64,String})() at eval.jl:75
withpath(::Atom.##100#105{String,Int64,String}, ::String) at utils.jl:30
withpath(::Function, ::String) at eval.jl:38
hideprompt(::Atom.##99#104{String,Int64,String}) at repl.jl:59
macro expansion at eval.jl:73 [inlined]
(::Atom.##98#103{Dict{String,Any}})() at task.jl:80

# train a kernel PCA model
M3 = fit(KernelPCA, data_array; maxoutdim=100, inverse=true)

UndefVarError: KernelPCA not defined
include_string(::String, ::String) at loading.jl:522
include_string(::String, ::String, ::Int64) at eval.jl:30
include_string(::Module, ::String, ::String, ::Int64, ::Vararg{Int64,N} where N) at eval.jl:34
(::Atom.##100#105{String,Int64,String})() at eval.jl:75
withpath(::Atom.##100#105{String,Int64,String}, ::String) at utils.jl:30
withpath(::Function, ::String) at eval.jl:38
hideprompt(::Atom.##99#104{String,Int64,String}) at repl.jl:59
macro expansion at eval.jl:73 [inlined]
(::Atom.##98#103{Dict{String,Any}})() at task.jl:80

Could someone help out? Thanks.

Please

  1. quote your code with backticks,

  2. provide a self-contained minimal working example

  1. The code is in backticks. The error messages aren’t.
  2. Ok,
    Let’s generate a random array:
data = rand(100, 200)

and try to run (see documentation of package MultivariateStats.jl)

fit(FactorAnalysis, data; maxoutdim=100)

same for kernelPCA method

fit(KernelPCA, data; maxoutdim=100, inverse=true)

Both times I get the error messages

ERROR: UndefVarError: FactorAnalysis not defined

and

ERROR: UndefVarError: KernelPCA not defined

resp.

It’s because you are looking the doc of the master branch (“latest”) instead of the tagged release (“stable”) you have on your computer:

http://multivariatestatsjl.readthedocs.io/en/stable/

You can run Pkg.checkout("MultivariateStats") to get the latest version, but maybe there’s a reason why they haven’t released it yet.

I have done that to get the latest version from the master, but it still isn’t working for me.

It works for me, make sure to restart your Julia after checking out so you load the new version.

I have no clue what you do differently. I do 'Pkg.checkout(“MultivariateStats”) and Pkg.status("MultivariateStats") returns - MultivariateStats 0.4.0+ master.
Once I restart Julia still returns the same error message…

I’m not sure what’s wrong, I’ve got 0.4.0+ too, check if you have this file in you local .julia package folder, or try to force recompilation via Base.compilecache("MultivariateStats"). Last resort if renaming your package folder and reinstalling from scratch. Do you use v0.6.2 too ?

1 Like

Thanks @jonathanBieler! Base.compilecache("MultivariateStats") did the job. It’s still not running in atom but only on the command line but at least that.
I have renamed my package folder and reinstalled it from scratch over and over again for other packages and there are still some conflicts I can’t fix (eg MultivariateStats.jl clashes with DifferentialEquations.jl and with RDatasets.jl but I am currently trying to work around it).