Giter Club home page Giter Club logo

multiway-algorithms's Introduction

multiway-algorithms's People

Contributors

braun-steven avatar dependabot[bot] avatar fracpete avatar laeubi avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

multiway-algorithms's Issues

Allow external process to stop build process

  • iterative algorithms like PARAFAC can take a long time to finish
  • introduce a stopExecution() (or similar method) that allows an external process to stop the build and/or filter process in a controlled fashion

Why Tensor?

Hello, I really appreciated this library although I know it is just very young.
I think I will greatly benefit of such platform written in Java. I have real-time data in multidimensional data running in simulators which I use for testing, but in our lab great deal of the data acquired is multidimensional.
Currently, the biggest issue I see in the application of multiway algorithms is that they usually are not easily generalised for multiway (>3 modes) datasets. I've done a small literature review and I always find reports of incredible improvements (very "occult" benchmarks). These decomposition algorithms are rarely open source (TensorPy being an exception) and I think the major improvements have resulted almost exclusively of distributed vectorization in MPPs. I have collected a list of these algorithms (unfortunately not all the code) and I really want to contribute to this project.
My main question over this specific implementation is related to the interface Tensor. Why is it needed? Why cannot one just use the FeatureVectors (INDArrays) of a DataSet (nd4j, I saw that you contribute to both projects)? If I'm not mistaken you use it to obtain data in other modality but shouldn't these algorithms work independently of the modality?
Best regards,
Andre

Does not compile under Java 10

On Java 10.0.1, mvn clean package generates the following error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.0:compile (default-compile) on project multiway-algorithms: Fatal error compiling: java.lang.ExceptionInInitializerError: com.sun.tools.javac.code.TypeTags -> [Help 1]

When running mvn clean package -e, it looks like lombok is the issue (see also this lombok issue):

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.0:compile (default-compile) on project multiway-algorithms: Fatal error compiling: java.lang.ExceptionInInitializerError: com.sun.tools.javac.code.TypeTags -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.0:compile (default-compile) on project multiway-algorithms: Fatal error compiling
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Fatal error compiling
	at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:695)
	at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:118)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
	... 20 more
Caused by: org.codehaus.plexus.compiler.CompilerException: java.lang.ExceptionInInitializerError
	at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:191)
	at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile(JavacCompiler.java:170)
	at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:684)
	... 23 more
Caused by: java.lang.RuntimeException: java.lang.ExceptionInInitializerError
	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.handleExceptions(JavacTaskImpl.java:158)
	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:96)
	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:90)
	at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:126)
	... 25 more
Caused by: java.lang.ExceptionInInitializerError
	at lombok.javac.handlers.HandleGetter.<clinit>(HandleGetter.java:303)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:374)
	at lombok.core.SpiLoadUtil$1$1.next(SpiLoadUtil.java:111)
	at lombok.javac.HandlerLibrary.loadAnnotationHandlers(HandlerLibrary.java:171)
	at lombok.javac.HandlerLibrary.load(HandlerLibrary.java:156)
	at lombok.javac.JavacTransformer.<init>(JavacTransformer.java:44)
	at lombok.javac.apt.LombokProcessor.init(LombokProcessor.java:87)
	at lombok.core.AnnotationProcessor$JavacDescriptor.want(AnnotationProcessor.java:87)
	at lombok.core.AnnotationProcessor.init(AnnotationProcessor.java:140)
	at lombok.launch.AnnotationProcessorHider$AnnotationProcessor.init(AnnotationProcessor.java:69)
	at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment$ProcessorState.<init>(JavacProcessingEnvironment.java:674)
	at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment$DiscoveredProcessors$ProcessorStateIterator.next(JavacProcessingEnvironment.java:771)
	at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:866)
	at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.access$2100(JavacProcessingEnvironment.java:110)
	at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1202)
	at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1311)
	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1250)
	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:928)
	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:100)
	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.handleExceptions(JavacTaskImpl.java:142)
	... 28 more
Caused by: java.lang.ClassNotFoundException: com.sun.tools.javac.code.TypeTags
	at java.base/java.lang.ClassLoader.findClass(ClassLoader.java:711)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:566)
	at lombok.launch.ShadowClassLoader.loadClass(ShadowClassLoader.java:422)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:291)
	at lombok.javac.JavacTreeMaker$SchroedingerType.getFieldCached(JavacTreeMaker.java:156)
	at lombok.javac.JavacTreeMaker$TypeTag.typeTag(JavacTreeMaker.java:244)
	at lombok.javac.Javac.<clinit>(Javac.java:155)
	... 49 more

parafac: Add support for missing values

PARAFAC support for missing values can be added quite easily as follows:

In each iteration a missing value x_ijk can be estimated by x_ijk = sum_{1..F} (a_if * b_jf * c_kf)

The easiest approach would be to store a mask in the beginning that indicates which indices ijk had missing values and update the X tensor after each iteration with the reconstructed values from A,B,C. The reconstruction is calculated in each iteration anyway to compute the loss so this only needs to be cached and used for value estimation in a second step.

parafac: General Enhancements

General Enhancements

Below are some enhancements that should be implemented to further extend the PARAFAC algorithm.

  • Loading Matrix Initialization
  • Loading Matrix Constraining
  • Support for Missing Values

Loading Matrix Initialization

The loading matrices can be initialized in a few different ways. Currently available are:

  • PARAFAC.Initialization.RANDOM
  • PARAFAC.Initialization.SVD

Looking at the nway toolbox, there are two more initialization methods possible:

  • GRAM method (See also nway toolbox: 1, 2)
  • Random orthogonalized values

Loading Matrix Constraining

The loading matrices can be further constrained as shown here:

% const      A vector telling type of constraints put on the loadings of the
%            different modes. Same size as DimX but the i'th element tells
%            what constraint is on that mode.
%            0 => no constraint,
%            1 => orthogonality
%            2 => nonnegativity
%            3 => unimodality (and nonnegativitiy)
%            4 => L1 fitting (will be imposed in all modes)
%            5 => L1 fitting and nonnegativity (will be imposed in all modes)
%            If const is not defined, no constraints are used.
%            For no constraints in a threeway problem const = [0 0 0]

Support for Missing Values

PARAFAC support for missing values can be added quite easily as follows:

In each iteration a missing value x_ijk can be estimated by x_ijk = sum_{1..F} (a_if * b_jf * c_kf)

The easiest approach would be to store a mask in the beginning that indicates which indices ijk had missing values and update the X tensor after each iteration with the reconstructed values from A,B,C. The reconstruction is calculated in each iteration anyway to compute the loss so this only needs to be cached and used for value estimation in a second step.

(See also #1)

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.