I am trying to use the example of Curve Resolution as describe in the docs here but using the tecator.csv
dataset as the triliq.csv
is missing (could not find it). I try different things but I am stuck getting zeros and ones only in the weights C_MCRALS
. MWE as follow:
using ChemometricsTools
Raw = ChemometricsToolsDataset("tecator.csv")
Mixture = Matrix(Raw)[:,1:99]); # only absorbance spectra
pure = [10,11,20,21,28,29];
PURE = Mixture[pure,:];
impure = [collect(1:9); collect(12:19);collect(22:27)];
Mixture = Mixture[impure,:];
( W_NMF, H_NMF ) = NMF(Mixture; Factors = 3, maxiters = 300, tolerance = 1e-8)
(C_Simplisma,S_Simplisma, vars) = SIMPLISMA(Mixture; Factors = 18)
vars
#Find purest variables that are not neighbors with one another
cuts = S_Simplisma[ [1,3,17], :];
( C_MCRALS, S_MCRALS, err ) = MCRALS(Mixture, nothing, RangeNorm(cuts')(cuts')';
Factors = 3, maxiters = 10,
norm = (true, false),
nonnegative = (true, true) )
And this is what I get
julia> C_MCRALS
23×3 Array{Float64,2}:
0.0 0.0 1.0
0.0 0.0 1.0
0.0 0.0 1.0
0.0 0.0 1.0
⋮
0.0 0.0 1.0
0.0 0.0 1.0
0.0 0.0 1.0
0.0 0.0 1.0
julia> S_MCRALS
3×99 Array{Float64,2}:
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 … 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
2.76599 2.76854 2.77107 2.77363 2.77626 2.77899 2.78187 2.78493 2.7882 3.10123 3.08192 3.06295 3.04433 3.0261 3.00824 2.99068 2.97337
I also tried with my data, and I get the same thing. I am pretty sure I am not understanding the arguments in here. Any suggestion on your side @anon92994695? Thanks! (I also posted an issue, but I don’t think it is.)