Skip to content
Anomaly detection framework @ PayPal
Branch: master
Clone or download
Latest commit c6a41f4 Jun 22, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github added apache rat and apache licesnse headers (#35) Apr 22, 2019
YuritaSampleApp [#32] Add standalone docker demo app (#38) Apr 24, 2019
codequality add the entire Yurita code as an initial commit Mar 30, 2019
docs added apache rat and apache licesnse headers (#35) Apr 22, 2019
gradle/wrapper add the entire Yurita code as an initial commit Mar 30, 2019
libs add the entire Yurita code as an initial commit Mar 30, 2019
src [#7] Add Scala/Java code linter & resolve linter exceptions (#27) Apr 15, 2019
.gitignore add the entire Yurita code as an initial commit Mar 30, 2019
.travis.yml added apache rat and apache licesnse headers (#35) Apr 22, 2019
CODE_OF_CONDUCT.md [#23] Create a code of conduct document (#24) Apr 5, 2019
CONTRIBUTING.md [#13] Edited CONTRIBUTING.md (#12) Apr 4, 2019
LICENSE.md [#30]Create a Readthedocs Page with Data Flow information and Model i… Apr 12, 2019
PULL_REQUEST_TEMPLATE.md added apache rat and apache licesnse headers (#35) Apr 22, 2019
README.md Update README.md Jun 22, 2019
build.gradle [#39] Exclude sample app dir from Rat (#40) Apr 23, 2019
checkstyle.xml added apache rat and apache licesnse headers (#35) Apr 22, 2019
gradle.properties added apache rat and apache licesnse headers (#35) Apr 22, 2019
gradlew added apache rat and apache licesnse headers (#35) Apr 22, 2019
gradlew.bat added apache rat and apache licesnse headers (#35) Apr 22, 2019
logo_small.png Add files via upload (#46) May 16, 2019
mkdocs.yml added apache rat and apache licesnse headers (#35) Apr 22, 2019
scalastyle_config.xml adding docs support Apr 3, 2019
settings.gradle added apache rat and apache licesnse headers (#35) Apr 22, 2019

README.md

logo

Yurita

Join the chat at https://gitter.im/pp-yurita Build Status Codacy Badge License Documentation Status

Yurita is an open source project for developing large scale anomaly detection models Site

Getting Started

Documentation

Documentation on Yurita's architecture, statistical models available, anomaly detection pipeline/data flow, etc can be found here: https://yurita.readthedocs.io/en/latest/

Build from source

foo@bar:~/yurita$ ./gradlew clean build
foo@bar:~/yurita$ ./gradlew publishToMavenLocal

Install from Maven Central

Please build the project from source at this time or try our dockerized Yurita demo application to build automatically as we make the project jar available on Maven Central in upcoming few days.

<dependency>
    <groupId>io.github.paypal</groupId>
    <artifactId>yurita</artifactId>
    <version>1.0.0</version>
</dependency>

Other Required Dependencies:

<dependency>
    <groupId>org.apache.spark</groupId>
    <artifactId>spark-core_2.11</artifactId>
    <version>2.4.1</version>
</dependency>
<dependency>
    <groupId>org.apache.spark</groupId>
    <artifactId>spark-sql_2.11</artifactId>
    <version>2.4.1</version>
</dependency>

Running Dockerized Demo Application

YuritaSampleApp directory in the Yurita project root path contains a standalone scala project for you to play around with. Run the demo through Docker inside YuritaSampleApp directory as shown below.

Build Docker Image

foo@bar:~/YuritaSampleApp$ docker build -f Dockerfile -t yuritademo .

Run Docker Container

foo@bar:~/YuritaSampleApp$ docker run -p 8080:8080 -t yuritademo

Writing Your First App

Create SparkSession with your own configurations

val appName = "AnomalyDetectionAPI"
val sparkConf = new SparkConf().setAppName(appName).setMaster("local[*]")
val spark = SparkSession
    .builder()
    .config(sparkConf)
    .getOrCreate()

Create dataframe of your data points/attributes with what time interval they occur on

//sample window timestamp
val window1 = (dateFormat.parse("2011-01-18 01:00:00.0"), dateFormat.parse("2011-01-18 01:00:10.0"))
val inputDF: DataFrame = Seq(
    Person("Ned", "Stark", 40, 40.6, "M", Array(5.5), getTimestamp(window1)),
    Person("Arya", "Stark", 9, 40.1, "F", Array(5.6), getTimestamp(window2)),
    Person("Sansa", "Stark", 13, 46.3, "F", Array(5.6), getTimestamp(window3)),
    Person("Jon Snow", "Stark", 17, 11.4, "M", Array(12.4), getTimestamp(window1),
    ...
).toDF()

Create a data pipe that will perform specified stastical methods on set columns of dataframe within the window size.

val categoricalPipe = PipelineBuilder()
    .onColumns(Seq("surname", "gender"))
    .setWindowing(Window.fixed("1 hour"))
    .setWindowReferencing(windowRef)
    .buildCategoricalModel(
    Functions.Categorical.avgRef,
    Functions.Categorical.entropy,
    Functions.statResultThreshold(3.0))

Combine multiple pipelines

val workload = AnomalyWorkload.builder()
    .addAllPipelines(categoricalPipe)
    .addPartitioner("surname")
    .buildWithWatermark("timestamp", "2 hours")

Dataset extended api

df.detectAnomalies(workload).map(_.toString).foreach(println(_))

Full demo application code can be viewed in our YuritaSampleApp project.

Contributing to Yurita

Thank you very much for contributing to Yurita. Please read the contribution guidelines for the process.

License

Yurita is licensed under the Apache License, v2.0

You can’t perform that action at this time.