All Projects → HongZhaoHua → Jstarcraft Ai

HongZhaoHua / Jstarcraft Ai

Licence: apache-2.0
目标是提供一个完整的Java机器学习(Machine Learning/ML)框架,作为人工智能在学术界与工业界的桥梁. 让相关领域的研发人员能够在各种软硬件环境/数据结构/算法/模型之间无缝切换. 涵盖了从数据处理到模型的训练与评估各个环节,支持硬件加速和并行计算,是最快最全的Java机器学习库.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Jstarcraft Ai

Graphview
Flutter GraphView is used to display data in graph structures. It can display Tree layout, Directed and Layered graph. Useful for Family Tree, Hierarchy View.
Stars: ✭ 152 (-5%)
Mutual labels:  algorithm, tree
Js Tree List
Convert list to tree, managing a tree and its nodes.
Stars: ✭ 30 (-81.25%)
Mutual labels:  algorithm, tree
Learningmasteringalgorithms C
Mastering Algorithms with C 《算法精解:C语言描述》源码及Xcode工程、Linux工程
Stars: ✭ 615 (+284.38%)
Mutual labels:  algorithm, tree
Gofamily
🔥 大厂 BAT 面试高频知识点,后端技术体系。包含了 C GO Python, 网络,Redis ,MySQL ,消息队列 ,高并发,微服务,缓存,操作系统,算法,LeetCode 刷题等知识
Stars: ✭ 474 (+196.25%)
Mutual labels:  algorithm, structure
Bplustree
A minimal but extreme fast B+ tree indexing structure demo for billions of key-value storage
Stars: ✭ 1,598 (+898.75%)
Mutual labels:  algorithm, tree
Algorithms
CLRS study. Codes are written with golang.
Stars: ✭ 482 (+201.25%)
Mutual labels:  algorithm, tree
Dsa.js Data Structures Algorithms Javascript
🥞Data Structures and Algorithms explained and implemented in JavaScript + eBook
Stars: ✭ 6,251 (+3806.88%)
Mutual labels:  algorithm, tree
Algorithms
Minimal examples of data structures and algorithms in Python
Stars: ✭ 20,123 (+12476.88%)
Mutual labels:  algorithm, tree
Leetcode
LeetCode Solutions: A Record of My Problem Solving Journey.( leetcode题解,记录自己的leetcode解题之路。)
Stars: ✭ 45,650 (+28431.25%)
Mutual labels:  algorithm, tree
Data Structures Questions
golang sorting algorithm and data construction.
Stars: ✭ 977 (+510.63%)
Mutual labels:  algorithm, structure
Algorithms and data structures
180+ Algorithm & Data Structure Problems using C++
Stars: ✭ 4,667 (+2816.88%)
Mutual labels:  algorithm, tree
Data Structures
Common data structures and algorithms implemented in JavaScript
Stars: ✭ 139 (-13.12%)
Mutual labels:  algorithm, tree
Algodeck
An Open-Source Collection of 200+ Algorithmic Flash Cards to Help you Preparing your Algorithm & Data Structure Interview 💯
Stars: ✭ 4,441 (+2675.63%)
Mutual labels:  algorithm, tree
Treelib
An efficient implementation of tree data structure in python 2/3.
Stars: ✭ 540 (+237.5%)
Mutual labels:  algorithm, tree
Java Algorithms Implementation
Algorithms and Data Structures implemented in Java
Stars: ✭ 3,927 (+2354.38%)
Mutual labels:  algorithm, tree
Nanomorph
🚅 - Hyper fast diffing algorithm for real DOM nodes
Stars: ✭ 621 (+288.13%)
Mutual labels:  algorithm, tree
Javascript Datastructures Algorithms
📚 collection of JavaScript and TypeScript data structures and algorithms for education purposes. Source code bundle of JavaScript algorithms and data structures book
Stars: ✭ 3,221 (+1913.13%)
Mutual labels:  algorithm, tree
Data Structures Algorithms
My implementation of 85+ popular data structures and algorithms and interview questions in Python 3 and C++
Stars: ✭ 273 (+70.63%)
Mutual labels:  algorithm, tree
Algorithms
Study cases for Algorithms and Data Structures.
Stars: ✭ 32 (-80%)
Mutual labels:  algorithm, tree
Java Ds Algorithms
Data Structures and Algorithms in Java
Stars: ✭ 125 (-21.87%)
Mutual labels:  algorithm, tree

JStarCraft AI


License Total lines Codacy Badge

希望路过的同学,顺手给JStarCraft框架点个Star,算是对作者的一种鼓励吧!


JStarCraft AI是一个机器学习的轻量级框架.遵循Apache 2.0协议.

在学术界,绝大多数研究人员使用的编程语言是Python.

在工业界,绝大多数开发人员使用的编程语言是Java.

JStarCraft AI是一个基于Java语言的机器学习工具包,由一系列的数据结构,算法和模型组成.

目标是作为在学术界与工业界从事机器学习研发的相关人员之间的桥梁.普及机器学习在Java领域的应用.

作者 洪钊桦
E-mail [email protected], [email protected]

JStarCraft AI架构

JStarCraft AI框架各个模块之间的关系: ai


JStarCraft AI特性

  • 1.数据(data)
    • 属性与特征
      • 连续
      • 离散
    • 模块与实例
    • 选择,排序与切割
  • 2.环境(environment)
    • 串行计算
    • 并行计算
    • CPU计算
    • GPU计算
  • 3.数学(math)
    • 算法(algorithm)
      • 微积分(calculus)
      • 相关性(correlation)
        • 距离(distance)
        • 相似度(similarity)
      • 分解(decomposition)
      • 核技巧(kernel)
      • 概率(probability)
    • 数据结构(structure)
      • 标量
      • 向量
      • 矩阵
      • 张量
      • 单元
      • 表单
  • 4.调制解调(modem)
  • 5.模型(model)
    • 线性模型(linear)
    • 近邻模型(nearest neighbor)
    • 矩阵分解模型(matrix factorization)
    • 神经网络模型(neutral network)
      • 计算图
        • 节点
      • 正向传播与反向传播
      • 激活函数
      • 梯度更新
    • 概率图模型(probabilistic graphical)
    • 规则模型(rule)
    • 支持向量机模型(support vector machine)
    • 树模型(tree)
  • 6.优化(optimization)
    • 梯度下降法(gradient descent)
      • 批量梯度下降(batch gradient descent)
      • 随机梯度下降(stochastic gradient descent)
    • 牛顿法和拟牛顿法(newton method/quasi newton method)
    • 共轭梯度法(conjugate gradient)
    • 试探法(heuristic)
      • 模拟退火算法(simulate anneal)
      • 遗传算法(genetic)
      • 蚁群算法(ant colony)
      • 粒子群算法(particle swarm)
  • 7.有监督学习(supervised)
    • 分类
    • 回归
  • 8.无监督学习(unsupervised)
    • 聚类
    • 关联
  • 9.丰富的评估指标

JStarCraft AI教程

Maven依赖

<dependency>
    <groupId>com.jstarcraft</groupId>
    <artifactId>ai</artifactId>
    <version>1.0</version>
</dependency>

Gradle依赖

compile group: 'com.jstarcraft', name: 'ai', version: '1.0'

设置CPU环境

<dependency>
    <groupId>org.nd4j</groupId>
    <artifactId>nd4j-native-platform</artifactId>
    <version>1.0.0-beta3</version>
</dependency>

设置GPU环境

  • CUDA 9.0
<dependency>
    <groupId>org.nd4j</groupId>
    <artifactId>nd4j-cuda-9.0-platform</artifactId>
    <version>1.0.0-beta3</version>
</dependency>
  • CUDA 9.1
<dependency>
    <groupId>org.nd4j</groupId>
    <artifactId>nd4j-cuda-9.1-platform</artifactId>
    <version>1.0.0-beta3</version>
</dependency>
  • CUDA 9.2
<dependency>
    <groupId>org.nd4j</groupId>
    <artifactId>nd4j-cuda-9.2-platform</artifactId>
    <version>1.0.0-beta3</version>
</dependency>
  • CUDA 10.0
<dependency>
    <groupId>org.nd4j</groupId>
    <artifactId>nd4j-cuda-10.0-platform</artifactId>
    <version>1.0.0-beta3</version>
</dependency>
  • CUDA 10.1
<dependency>
    <groupId>org.nd4j</groupId>
    <artifactId>nd4j-cuda-10.1-platform</artifactId>
    <version>1.0.0-beta3</version>
</dependency>

使用环境上下文

// 获取默认环境上下文
EnvironmentContext context = EnvironmentContext.getContext();
// 在环境上下文中执行任务
Future<?> task = context.doTask(() - > {
    int dimension = 10;
    MathMatrix leftMatrix = getRandomMatrix(dimension);
    MathMatrix rightMatrix = getRandomMatrix(dimension);
    MathMatrix dataMatrix = getZeroMatrix(dimension);
    dataMatrix.dotProduct(leftMatrix, false, rightMatrix, true, MathCalculator.PARALLEL);
});

数据表示

  • 未处理的形式(转换前)
用户(User) 旧手机类型(Item) 新手机类型(Item) 评分(Score)
Google Fan Android Android 3
Google Fan Android IOS 1
Google Fan IOS Android 5
Apple Fan IOS IOS 3
Apple Fan Android IOS 5
Apple Fan IOS Android 1
  • 已处理的形式(转换后)
定性(User) 定性(Item) 定性(Item) 定量(Score)
0 0 0 3
0 0 1 1
0 1 0 5
1 1 1 3
1 0 1 5
1 1 0 1

数据转换

数据转换器(DataConverter)负责各种各样的格式转换为JStarCraft AI框架能够处理的数据模块(DataModule).

JStarCraft AI框架各个转换器与其它系统之间的关系:

converter

  • 定义数据属性
// 定性属性
Map<String, Class<?>> qualityDifinitions = new HashMap<>();
qualityDifinitions.put("user", String.class);
qualityDifinitions.put("item", String.class);

// 定量属性
Map<String, Class<?>> quantityDifinitions = new HashMap<>();
quantityDifinitions.put("score", float.class);
DataSpace space = new DataSpace(qualityDifinitions, quantityDifinitions);
  • 定义数据模块
TreeMap<Integer, String> configuration = new TreeMap<>();
configuration.put(1, "user");
configuration.put(3, "item");
configuration.put(4, "score");
DataModule module = space.makeDenseModule("module", configuration, 1000);

JStarCraft AI框架兼容的格式

  • ARFF
// ARFF转换器
ArffConverter converter = new ArffConverter(space.getQualityAttributes(), space.getQuantityAttributes());

// 获取流
File file = new File(this.getClass().getResource("module.arff").toURI());
InputStream stream = new FileInputStream(file);

// 转换数据
int count = converter.convert(module, stream, null, null, null);
  • CSV
// CSV转换器
CsvConverter converter = new CsvConverter(',', space.getQualityAttributes(), space.getQuantityAttributes());

// 获取流
File file = new File(this.getClass().getResource("module.csv").toURI());
InputStream stream = new FileInputStream(file);

// 转换数据
int count = converter.convert(module, stream, null, null, null);
  • JSON
// JSON转换器
JsonConverter converter = new JsonConverter(space.getQualityAttributes(), space.getQuantityAttributes());

// 获取流
File file = new File(this.getClass().getResource("module.json").toURI());
InputStream stream = new FileInputStream(file);

// 转换数据
int count = converter.convert(module, stream, null, null, null);
  • HQL
// HQL转换器
QueryConverter converter = new QueryConverter(space.getQualityAttributes(), space.getQuantityAttributes());

// 获取游标
String selectDataHql = "select data.user, data.leftItem, data.rightItem, data.score from MockData data";
Session session = sessionFactory.openSession();
Query query = session.createQuery(selectDataHql);
ScrollableResults iterator = query.scroll();

// 转换数据
int count = converter.convert(module, iterator, null, null, null);
session.close();
  • SQL
// SQL转换器
QueryConverter converter = new QueryConverter(space.getQualityAttributes(), space.getQuantityAttributes());

// 获取游标
String selectDataSql = "select user, leftItem, rightItem, score from MockData";
Session session = sessionFactory.openSession();
Query query = session.createQuery(selectDataSql);
ScrollableResults iterator = query.scroll();

// 转换数据
int count = converter.convert(module, iterator, null, null, null);
session.close();

数据处理

  • 选择

  • 排序

  • 切割


评估指标

排序指标

  • AUC
  • Diversity
  • MAP
  • MRR
  • NDCG
  • Novelty
  • Precision
  • Recall

评分指标

  • MAE
  • MPE
  • MSE/RMSE
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].