Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ build/*.jar
.settings
.cache
target/*
dynaml-core/target/*
dynaml-examples/target/*
dynaml-pipes/target/*
.DS_Store
release.properties
*.log
Expand Down
28 changes: 16 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,22 @@ Steps
You should get the following prompt.

```
___ ___ ___ ___ ___ ___
/\ \ /\__\ /\__\ /\ \ /\__\ /\__\
/::\ \ |::L__L /:| _|_ /::\ \ /::L_L_ /:/ /
/:/\:\__\ |:::\__\ /::|/\__\ /::\:\__\ /:/L:\__\ /:/__/
\:\/:/ / /:;;/__/ \/|::/ / \/\::/ / \/_/:/ / \:\ \
\::/ / \/__/ |:/ / /:/ / /:/ / \:\__\
\/__/ \/__/ \/__/ \/__/ \/__/

Welcome to DynaML v 1.3
Interactive Scala shell

DynaML>
___ ___ ___ ___ ___ ___
/\ \ |\__\ /\__\ /\ \ /\__\ /\__\
/::\ \ |:| | /::| | /::\ \ /::| | /:/ /
/:/\:\ \ |:| | /:|:| | /:/\:\ \ /:|:| | /:/ /
/:/ \:\__\ |:|__|__ /:/|:| |__ /::\~\:\ \ /:/|:|__|__ /:/ /
/:/__/ \:|__| /::::\__\ /:/ |:| /\__\ /:/\:\ \:\__\ /:/ |::::\__\ /:/__/
\:\ \ /:/ / /:/~~/~ \/__|:|/:/ / \/__\:\/:/ / \/__/~~/:/ / \:\ \
\:\ /:/ / /:/ / |:/:/ / \::/ / /:/ / \:\ \
\:\/:/ / \/__/ |::/ / /:/ / /:/ / \:\ \
\::/__/ /:/ / /:/ / /:/ / \:\__\
~~ \/__/ \/__/ \/__/ \/__/

Welcome to DynaML v1.4-beta.8
Interactive Scala shell for Machine Learning Research
(Scala 2.11.7 Java 1.7.0_80)
DynaML>
```

Getting Started
Expand Down
58 changes: 46 additions & 12 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import sbt._
import java.io.File

import sbtbuildinfo.BuildInfoPlugin.autoImport._

maintainer := "Mandar Chandorkar <mandar2812@gmail.com>"

packageSummary := "Scala Library/REPL for Machine Learning Research"
Expand All @@ -10,16 +12,17 @@ packageDescription := "DynaML is a scala library/repl for implementing and worki
"which can be extended easily to implement advanced models for small and large scale applications.\n\n"+
"But the library can also be used as an educational/research tool for data analysis."

val mainVersion = "v1.4-beta.8"

val dataDirectory = settingKey[File]("The directory holding the data files for running example scripts")

lazy val commonSettings = Seq(
name := "DynaML",
val baseSettings = Seq(
organization := "io.github.mandar2812",
version := "v1.4-beta.7",
scalaVersion in ThisBuild := "2.11.7",
mainClass in Compile := Some("io.github.mandar2812.dynaml.DynaML"),
fork in run := true,
resolvers in ThisBuild ++= Seq("jzy3d-releases" at "http://maven.jzy3d.org/releases"),
resolvers in ThisBuild ++= Seq("jzy3d-releases" at "http://maven.jzy3d.org/releases")
)

lazy val commonSettings = Seq(
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-compiler" % scalaVersion.value % "compile",
"org.scala-lang" % "scala-library" % scalaVersion.value % "compile",
Expand All @@ -42,15 +45,42 @@ lazy val commonSettings = Seq(
"com.quantifind" % "wisp_2.11" % "0.0.4" % "compile",
"org.jzy3d" % "jzy3d-api" % "0.9.1" % "compile",
"com.lihaoyi" % "ammonite-repl_2.11.7" % "0.5.8"
),
dataDirectory := new File("data/"),
initialCommands in console := """io.github.mandar2812.dynaml.DynaML.run(banner="""" +
target.value.getPath + """/universal/stage/conf/banner.txt");"""
)
)

lazy val pipes = (project in file("dynaml-pipes")).settings(baseSettings:_*)
.settings(
name := "dynaml-pipes",
version := "1.0"
)

lazy val core = (project in file("dynaml-core")).settings(baseSettings)
.settings(commonSettings:_*)
.enablePlugins(JavaAppPackaging, BuildInfoPlugin)
.dependsOn(pipes)
.settings(
name := "dynaml-core",
version := mainVersion
)

lazy val examples = (project in file("dynaml-examples"))
.settings(baseSettings:_*)
.settings(commonSettings:_*)
.settings(
name := "dynaml-examples",
version := "1.0"
).dependsOn(pipes, core)

lazy val DynaML = (project in file(".")).enablePlugins(JavaAppPackaging, BuildInfoPlugin)
.settings(baseSettings:_*)
.settings(commonSettings: _*)
.dependsOn(core, examples, pipes)
.settings(
//aggregate in update := false,
name := "DynaML",
version := mainVersion,
fork in run := true,
mainClass in Compile := Some("io.github.mandar2812.dynaml.DynaML"),
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion),
buildInfoPackage := "io.github.mandar2812.dynaml.repl",
buildInfoUsePackageAsPath := true,
Expand All @@ -67,6 +97,10 @@ lazy val DynaML = (project in file(".")).enablePlugins(JavaAppPackaging, BuildIn
// -J params will be added as jvm parameters
"-J-Xmx2048m",
"-J-Xms64m"
)
)
),
dataDirectory := new File("data/"),
initialCommands in console := """io.github.mandar2812.dynaml.DynaML.run(banner="""" +
target.value.getPath + """/universal/stage/conf/banner.txt");"""

)

Original file line number Diff line number Diff line change
@@ -1,35 +1,14 @@
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
* */
package io.github.mandar2812.dynaml.pipes
package io.github.mandar2812.dynaml

import scala.collection.mutable.{MutableList => ML}
import breeze.linalg.DenseVector
import io.github.mandar2812.dynaml.evaluation.RegressionMetrics
import io.github.mandar2812.dynaml.models.ParameterizedLearner
import io.github.mandar2812.dynaml.models.gp.AbstractGPRegressionModel
import io.github.mandar2812.dynaml.optimization.{
CoupledSimulatedAnnealing, GPMLOptimizer,
GloballyOptWithGrad, GridSearch}
import io.github.mandar2812.dynaml.utils
import io.github.mandar2812.dynaml.optimization.{CoupledSimulatedAnnealing, GPMLOptimizer, GloballyOptWithGrad, GridSearch}
import io.github.mandar2812.dynaml.pipes.{DataPipe, StreamDataPipe}
import org.apache.log4j.Logger

import scala.collection.mutable.{MutableList => ML}

/**
* @author mandar2812 datum 3/2/16.
*
Expand Down Expand Up @@ -325,7 +304,7 @@ object DynaMLPipe {
* Takes a base pipe and creates a parallel pipe by duplicating it.
*
* @param pipe The base data pipe
* @return a [[ParallelPipe]] object.
* @return a [[io.github.mandar2812.dynaml.pipes.ParallelPipe]] object.
* */
def duplicate[Source, Destination](pipe: DataPipe[Source, Destination]) =
DataPipe(pipe, pipe)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
* */
package io.github.mandar2812.dynaml.graphutils
package io.github.mandar2812.dynaml.graph

import com.tinkerpop.frames.{Property, OutVertex, InVertex, EdgeFrame}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
* */
package io.github.mandar2812.dynaml.graphutils
package io.github.mandar2812.dynaml.graph

import com.tinkerpop.blueprints.Direction
import com.tinkerpop.frames.{Adjacency, VertexFrame, Property}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
* */
package io.github.mandar2812.dynaml.graphutils
package io.github.mandar2812.dynaml.graph

import com.tinkerpop.blueprints.Direction
import com.tinkerpop.frames.{Incidence, Property, VertexFrame}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
* */
package io.github.mandar2812.dynaml.graphutils
package io.github.mandar2812.dynaml.graph

import com.tinkerpop.frames.{InVertex, OutVertex, EdgeFrame}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
* */
package io.github.mandar2812.dynaml.graphutils
package io.github.mandar2812.dynaml.graph

import com.tinkerpop.blueprints.Direction
import com.tinkerpop.frames.{Adjacency, VertexFrame, Property}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
* */
package io.github.mandar2812.dynaml.graphutils
package io.github.mandar2812.dynaml.graph

import com.tinkerpop.blueprints.Direction
import com.tinkerpop.frames.{Adjacency, VertexFrame, Property}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
* */
package io.github.mandar2812.dynaml.graphutils
package io.github.mandar2812.dynaml.graph

import com.tinkerpop.frames.{Property, InVertex, OutVertex, EdgeFrame}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package io.github.mandar2812.dynaml.models

import breeze.linalg.{DenseMatrix, DenseVector}
import io.github.mandar2812.dynaml.kernels.CovarianceFunction
import io.github.mandar2812.dynaml.models.svm.DLSSVM

/**
* Created by mandar on 15/6/16.
*/
class DLSSVMPipe[Source](pre: (Source) => Stream[(DenseVector[Double], Double)],
cov: CovarianceFunction[DenseVector[Double], Double, DenseMatrix[Double]],
task: String = "regression") extends
ModelPipe[Source, Stream[(DenseVector[Double], Double)],
DenseVector[Double], Double, DLSSVM] {

override val preProcess = pre

override def run(data: Source) = {
val training = preProcess(data)
new DLSSVM(training, training.length, cov, task)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package io.github.mandar2812.dynaml.models

import breeze.linalg.DenseVector
import io.github.mandar2812.dynaml.models.lm.GeneralizedLinearModel

/**
* Created by mandar on 15/6/16.
*/
class GLMPipe[T, Source](pre: (Source) => Stream[(DenseVector[Double], Double)],
map: (DenseVector[Double]) => (DenseVector[Double]) = identity _,
task: String = "regression", modelType: String = "") extends
ModelPipe[Source, Stream[(DenseVector[Double], Double)],
DenseVector[Double], Double,
GeneralizedLinearModel[T]] {

override val preProcess = pre

override def run(data: Source) = {
val training = preProcess(data)
GeneralizedLinearModel[T](training, task, map, modelType)
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package io.github.mandar2812.dynaml.models

import breeze.linalg.{DenseMatrix, DenseVector}
import io.github.mandar2812.dynaml.kernels.CovarianceFunction
import io.github.mandar2812.dynaml.models.gp.AbstractGPRegressionModel

/**
* Created by mandar on 15/6/16.
*/
class GPRegressionPipe[M <:
AbstractGPRegressionModel[Seq[(DenseVector[Double], Double)],
DenseVector[Double]], Source](pre: (Source) => Seq[(DenseVector[Double], Double)],
cov: CovarianceFunction[DenseVector[Double], Double, DenseMatrix[Double]],
n: CovarianceFunction[DenseVector[Double], Double, DenseMatrix[Double]],
order: Int = 0, ex: Int = 0)
extends ModelPipe[Source, Seq[(DenseVector[Double], Double)],
DenseVector[Double], Double, M] {

override val preProcess: (Source) => Seq[(DenseVector[Double], Double)] = pre

override def run(data: Source): M =
AbstractGPRegressionModel[M](preProcess(data), cov, n, order, ex)

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package io.github.mandar2812.dynaml.models

import io.github.mandar2812.dynaml.pipes.DataPipe

/**
* Top level trait for Pipes involving ML models.
*/
trait ModelPipe[Source, T, Q, R, M <: Model[T, Q, R]]
extends DataPipe[Source, M]{

val preProcess: (Source) => T

override def run(data: Source): M
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ package io.github.mandar2812.dynaml.models.ensemble
import breeze.linalg.DenseVector
import io.github.mandar2812.dynaml.models.gp.GPRegression
import io.github.mandar2812.dynaml.models.neuralnets.FeedForwardNetwork
import io.github.mandar2812.dynaml.models.{LinearModel, Model}
import io.github.mandar2812.dynaml.pipes.ModelPipe
import io.github.mandar2812.dynaml.models.{LinearModel, Model, ModelPipe}

/**
* Defines an abstract implementation of a "committee-model".
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ under the License.
package io.github.mandar2812.dynaml.models.ensemble

import breeze.linalg.DenseVector
import io.github.mandar2812.dynaml.models.Model
import io.github.mandar2812.dynaml.models.{Model, ModelPipe}
import io.github.mandar2812.dynaml.models.gp.GPRegression
import io.github.mandar2812.dynaml.models.neuralnets.FeedForwardNetwork
import io.github.mandar2812.dynaml.pipes.ModelPipe

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ under the License.
package io.github.mandar2812.dynaml.models.gp

import breeze.linalg.DenseVector
import io.github.mandar2812.dynaml.models.LinearModel
import io.github.mandar2812.dynaml.pipes.GPRegressionPipe
import io.github.mandar2812.dynaml.models.{GPRegressionPipe, LinearModel}

/**
* Created by mandar on 9/2/16.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ under the License.
package io.github.mandar2812.dynaml.models.neuralnets

import breeze.linalg.DenseVector
import io.github.mandar2812.dynaml.pipes.ModelPipe
import io.github.mandar2812.dynaml.models.ModelPipe

/**
* Created by mandar on 23/2/16.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ package io.github.mandar2812.dynaml.models.neuralnets
import breeze.linalg.DenseVector
import com.tinkerpop.blueprints.{GraphFactory, Graph}
import com.tinkerpop.frames.{FramedGraphFactory, FramedGraph}
import io.github.mandar2812.dynaml.graphutils.{Neuron, Synapse}
import io.github.mandar2812.dynaml.graph.{Neuron, Synapse}
import org.apache.log4j.Logger

import scala.collection.JavaConversions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package io.github.mandar2812.dynaml.models.svm
import breeze.linalg.{DenseMatrix, DenseVector, norm}
import com.tinkerpop.blueprints.Graph
import com.tinkerpop.frames.FramedGraph
import io.github.mandar2812.dynaml.graphutils.{CausalEdge, Parameter, Point}
import io.github.mandar2812.dynaml.graph.{CausalEdge, Parameter, Point}
import io.github.mandar2812.dynaml.kernels.{GaussianDensityKernel, RBFKernel, SVMKernel}
import io.github.mandar2812.dynaml.models.KernelizedModel
import io.github.mandar2812.dynaml.optimization.ConjugateGradient
Expand Down
Loading