Closed LeXing1105 closed 1 year ago
double[][] ICA_results = new double[32][250*5];
ICA_results is an empty array, What I understand is: the ICA will return and store the ICs to the 'ICA_results' array
Your code is wrong. ICA.fit is a static method and it returns the model. You should do something like
ICA model = ICA.fit(data, 32, ...);
double[][] ica_results = ice.components;
Note that you should build the master branch to use latest ICA. If it works as you expect, I will make a new release so that you can get it from maven.
@haifengl Sir, thank you very much for your reply and example! Now I have changed the code a bit as you said, but something is still wrong here, making the program crash! I am using 'smile-base-3.0.0', by using Gradle: implementation 'com.github.haifengl:smile-core:3.0.0'
(The library imported is shown on the left of the screenshot)
Do you have any ideas for this issue? Your help will be highly appreciated!
Best wishes, Le
Can you share the error message and stack trace?
Thank you for coming back to me!
In my Android App, I click the button to execute the ICA algorithm, and then the App crashes, the error message and stack trace is attached here.
You should add following libraries
libraryDependencies ++= Seq(
"org.bytedeco" % "javacpp" % "1.5.8" classifier "android-arm64"
"org.bytedeco" % "openblas" % "0.3.21-1.5.8" classifier "android-arm64"
)
Hi Sir, I added the implementations to Gradle, like the attached screenshot, and then ran the program, but it still crashed. In Android, I cannot add libraries as you showed me, need to use gradle / maven.
Error message: Caused by: java.lang.UnsatisfiedLinkError: Could not find jniopenblas_nolapack in class, module, and library paths. What's the problem this time? Thank you for your help!
If you're building Android App Bundles (AAB files), the Android plugin doesn't support native libraries in JAR files. We can use the Platform Plugin from Gradle JavaCPP to work around that though: https://github.com/bytedeco/gradle-javacpp#the-platform-plugin
@saudet Perfect! problem solved! The program is working very well now, after adding the JavaCPP libraries as you said. Thank you very much for your help!
Also, thank you again for your help! @haifengl
Merry Christmas to both of you!!! :)
Describe the bug I am creating a simulated multiple-channel EEG signal using random numbers, which has an array size of 'double[32][1250]' in Java.
I want to use the ICA algorithm for computing the Independent Components for a quick test on Android Studio for smartphones. When I use the 'ICA' class, the results were all zeros, nothing comes out.
Expected behavior I would expect the algorithm can output 32 independent components, the same data size as the input.
Actual behavior However, the results are wrong!
Could you please help me with debugging or show me an example of how to use the code correctly? Your Java library is very good, the programming styles are easy to understand. Thank you very much if you could reply or help! Attached is my code.