Skip to content

Commit

Permalink
Support for Leiningen project is added according to request of @jonas…
Browse files Browse the repository at this point in the history
  • Loading branch information
dima committed Mar 11, 2018
1 parent 76b1cd2 commit a8c5875
Show file tree
Hide file tree
Showing 7 changed files with 202 additions and 117 deletions.
5 changes: 3 additions & 2 deletions README.md
Expand Up @@ -4,7 +4,7 @@

<br/>

<img src="img/desision_stream.jpg" width="60%"/>
<img src="img/decision-stream.jpg" width="60%"/>

<br/>

Expand All @@ -28,7 +28,8 @@ The dependencies are configured in the pom.xml file.
#### 3. First steps

- Extract the archive ```data.gz``` with training data by running ```tar -xvzf data.gz```
- *Optional:* rebuild ```decision-stream.jar``` with ```mvn package``` [Maven](https://maven.apache.org/) command.
- *Optional:* rebuild ```decision-stream.jar``` with [Leiningen](https://leiningen.org/) (```lein uberjar```) or [Maven](https://maven.apache.org/) (```mvn package```).

<br/><br/>

#### 4. Train the model
Expand Down
Binary file modified decision-stream.jar
Binary file not shown.
File renamed without changes
251 changes: 157 additions & 94 deletions pom.xml
@@ -1,95 +1,158 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>decision-stream</groupId>
<artifactId>decision-stream</artifactId>
<packaging>jar</packaging>
<version>1.0</version>
<name>decision-stream</name>
<description>This repository provides a basic implementation of the Decision Stream regression and classification algorithms.</description>
<url>https://github.com/aiff22/Decision-Stream/</url>
<licenses>
<license>
<name>Eclipse Public License</name>
<url>http://www.eclipse.org/legal/epl-v10.html</url>
</license>
</licenses>
<build>
<sourceDirectory>src/main/clojure</sourceDirectory>
<testSourceDirectory>test</testSourceDirectory>
<resources>
<resource>
<directory>resources</directory>
</resource>
</resources>
<testResources>
<testResource>
<directory>resources</directory>
</testResource>
</testResources>
<directory>target</directory>
<outputDirectory>target/classes</outputDirectory>
<plugins>
<plugin>
<groupId>com.theoryinpractise</groupId>
<artifactId>clojure-maven-plugin</artifactId>
<version>1.8.1</version>
<executions>
<execution>
<id>compile</id>
<goals>
<goal>compile</goal>
</goals>
<phase>compile</phase>
<configuration>
<namespaces>
<namespace>DecisionStream</namespace>
</namespaces>
<sourceDirectories>
<sourceDirectory>src/main/clojure</sourceDirectory>
</sourceDirectories>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>package-jar-with-dependencies</id>
<goals>
<goal>single</goal>
</goals>
<phase>package</phase>
<configuration>
<finalName>decision-stream</finalName>
<appendAssemblyId>false</appendAssemblyId>
<outputDirectory>${project.basedir}</outputDirectory>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>DecisionStream</mainClass>
</manifest>
</archive>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>src/main/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
<repository>
<id>clojars</id>
<url>https://repo.clojars.org/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
<dependencyManagement>
<dependencies/>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.clojure</groupId>
<artifactId>clojure</artifactId>
<version>1.9.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
<version>3.6.1</version>
</dependency>
<dependency>
<groupId>org.jblas</groupId>
<artifactId>jblas</artifactId>
<version>1.2.4</version>
</dependency>
<dependency>
<groupId>au.com.bytecode</groupId>
<artifactId>opencsv</artifactId>
<version>2.4</version>
</dependency>
</dependencies>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
</project>

<groupId>decision</groupId>
<artifactId>decision-steam</artifactId>
<version>1.0-SNAPSHOT</version>

<dependencies>
<dependency>
<groupId>org.clojure</groupId>
<artifactId>clojure</artifactId>
<version>1.8.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
<version>3.6.1</version>
</dependency>
<dependency>
<groupId>net.sf.opencsv</groupId>
<artifactId>opencsv</artifactId>
<version>2.3</version>
</dependency>
<dependency>
<groupId>org.jblas</groupId>
<artifactId>jblas</artifactId>
<version>1.2.4</version>
</dependency>
</dependencies>
<build>
<finalName>decision-stream</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>src/main/clojure/</directory>
</resource>
</resources>
<outputDirectory>${project.build.outputDirectory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>package-jar-with-dependencies</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<outputDirectory>${project.basedir}</outputDirectory>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>edu.decision.stream.Main</mainClass>
</manifest>
</archive>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
<!-- This file was autogenerated by Leiningen.
Please do not edit it directly; instead edit project.clj and regenerate it.
It should not be considered canonical data. For more information see
https://github.com/technomancy/leiningen -->
39 changes: 39 additions & 0 deletions project.clj
@@ -0,0 +1,39 @@
(defproject decision-stream "1.0"
:description "This repository provides a basic implementation of the Decision Stream regression and classification algorithms."
:url "https://github.com/aiff22/Decision-Stream/"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.9.0"]
[org.apache.commons/commons-math3 "3.6.1"]
[org.jblas/jblas "1.2.4"]
[au.com.bytecode/opencsv "2.4"]]
:java-source-paths ["src/main/java"]
:source-paths ["src/main/clojure"]
:aot :all
:main DecisionStream
:uberjar-name "decision-stream.jar"

;Following code generates pom.xml for maven project
:pom-addition [:properties
["maven.compiler.source" "1.8"]
["maven.compiler.target" "1.8"]]
:pom-plugins [[com.theoryinpractise/clojure-maven-plugin "1.8.1"
{:executions ([:execution [:id "compile"]
[:goals ([:goal "compile"])]
[:phase "compile"]
[:configuration
[:namespaces ([:namespace "DecisionStream"])]
[:sourceDirectories ([:sourceDirectory "src/main/clojure"])]
]])}]
[org.apache.maven.plugins/maven-assembly-plugin "3.1.0"
{:executions ([:execution [:id "package-jar-with-dependencies"]
[:goals ([:goal "single"])]
[:phase "package"]
[:configuration
[:finalName "decision-stream"]
[:appendAssemblyId "false"]
[:outputDirectory "${project.basedir}"]
[:descriptorRefs ([:descriptorRef "jar-with-dependencies"])]
[:archive [:manifest [:mainClass "DecisionStream"]]]
]])}]]
)
5 changes: 3 additions & 2 deletions src/main/clojure/DecisionStream.clj
Expand Up @@ -5,7 +5,8 @@
org.jblas.DoubleMatrix
edu.decision.stream.MatrixUtil
java.util.Arrays
java.lang.reflect.Array))
java.lang.reflect.Array)
(:gen-class))

(declare ^:dynamic pLevel)
(declare ^:dynamic mgLevel)
Expand Down Expand Up @@ -181,7 +182,7 @@
(defn readData [fileName] (readCSV (csvReader (str baseDir fileName))))
(defn readAnswers [fileName] (mapv first (readData fileName)))

(defn main [args]
(defn -main [& args]
(if (not= 7 (count args))
(do (println "Wrong number of arguments.")
(println "Usage: java -jar decision-stream.jar base-directory train-data train-answers test-data test-answers classification/regression significance-threshold")
Expand Down
19 changes: 0 additions & 19 deletions src/main/java/edu/decision/stream/Main.java

This file was deleted.

0 comments on commit a8c5875

Please sign in to comment.