一、前言

主页:https://www.h2o.ai/products/h2o4gpu/

GPU版本安装:h2oai/h2o4gpu

采用GPU,能否成为超越下面链接中实验的存在?

[ML] LIBSVM Data: Classification, Regression, and Multi-label

Solver Classes

Among others, the solver can be used for the following classes of problems

    • GLM: Lasso, Ridge Regression, Logistic Regression, Elastic Net Regulariation
    • KMeans
    • Gradient Boosting Machine (GBM) via XGBoost
    • Singular Value Decomposition(SVD) + Truncated Singular Value Decomposition
    • Principal Components Analysis(PCA)

Real time bench mark: https://www.youtube.com/watch?v=LrC3mBNG7WU,速度快二十倍。

二、安装

注意事项:安装升级驱动时,先切换为x-windows状态;安装cuda时,不安装自带的驱动,因为之前已经安装过了。

hadoop@unsw-ThinkPad-T490:~/NVIDIA_CUDA-.1_Samples/bin/x86_64/linux/release$ nvidia-smi
Thu Nov ::
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.31 Driver Version: 440.31 CUDA Version: 10.2 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| GeForce MX250 Off | :3C:00.0 Off | N/A |
| N/A 58C P0 N/A / N/A | 390MiB / 2002MiB | % Default |
+-------------------------------+----------------------+----------------------+ +-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| G /usr/lib/xorg/Xorg 190MiB |
| G /usr/bin/gnome-shell 136MiB |
| G ...uest-channel-token= 59MiB |
+-----------------------------------------------------------------------------+

三、测试

当迭代更多次时,h2o的优势开始显现;至于“预测”,cpu已经非常快。

import os
import time
from sklearn.linear_model import MultiTaskLasso, Lasso
from sklearn.datasets import load_svmlight_file
from sklearn.metrics import r2_score
from sklearn.metrics import mean_squared_error import h2o4gpu
import h2o4gpu.util.import_data as io
import h2o4gpu.util.metrics as metrics
import pandas as pd
import numpy as np #from joblib import Memory
#mem = Memory("./mycache") # This maybe a tricky way to load files.
##@mem.cache
def get_data():
data = load_svmlight_file("/home/hadoop/YearPredictionMSD")
return data[0], data[1] print("Loading data.")
train_x, train_y = load_svmlight_file("/home/hadoop/YearPredictionMSD")
train_x = train_x.todense() test_x, test_y = load_svmlight_file("/home/hadoop/YearPredictionMSD.t")
test_x = test_x.todense() for max_iter in [100, 500, 1000, 2000, 4000, 8000]:
print("="*80)
print("Setting up solver, msx_iter is {}".format(max_iter))
model = h2o4gpu.Lasso(alpha=0.01, fit_intercept=False, max_iter=max_iter)
#model = Lasso(alpha=0.1, fit_intercept=False, max_iter=500) time_start=time.time()
model.fit(train_x, train_y)
time_end=time.time()
print('train totally cost {} sec'.format(time_end-time_start)) time_start=time.time()
y_pred_lasso = model.predict(test_x)
y_pred_lasso = np.squeeze(y_pred_lasso)
time_end=time.time()
print('test totally cost {} sec'.format(time_end-time_start)) print(y_pred_lasso.shape )
print(test_y.shape ) print(y_pred_lasso[:10])
print(test_y[:10]) mse = mean_squared_error(test_y, y_pred_lasso)
print("mse on test data : %f" % mse)
r2_score_lasso = r2_score(test_y, y_pred_lasso)
print("r^2 on test data : %f" % r2_score_lasso)

End.

[GPU] Install H2O.ai的更多相关文章

  1. H2O.ai初步使用

    1.官网下载最新稳定版,https://www.h2o.ai/download/ ,如果点击下载无反应,请使用ie浏览器 2.解压h2o-3.18.0.10.zip到目录h2o-3.18.0.10 3 ...

  2. [GPU] Machine Learning on C++

    一.MPI为何物? 初步了解:MPI集群环境搭建 二.重新认识Spark 链接:https://www.zhihu.com/question/48743915/answer/115738668 马铁大 ...

  3. H2O Driverless AI

    H2O Driverless AI(H2O无驱动人工智能平台)是一个自动化的机器学习平台,它给你一个有着丰富经验的“数据科学家之盒”来完成你的算法. 使AI技术得到大规模应用 各地的企业都意识到人工智 ...

  4. 在windows上极简安装GPU版AI框架(Tensorflow、Pytorch)

    在windows上极简安装GPU版AI框架 如果我们想在windows系统上安装GPU版本的AI框架,比如GPU版本的tesnorflow,通常我们会看到类似下面的安装教程 官方版本 安装CUDA 安 ...

  5. AI - H2O - 第一个示例

    1 - Iris数据集 Iris数据集是常用的机器学习分类实验数据集,特点是数据量很小,可以快速学习. 数据集包含150个数据集,分为3类,每类50个数据,每个数据包含4个属性. Sepal.Leng ...

  6. AI解决方案:边缘计算和GPU加速平台

    AI解决方案:边缘计算和GPU加速平台 一.适用于边缘 AI 的解决方案 AI 在边缘蓬勃发展.AI 和云原生应用程序.物联网及其数十亿的传感器以及 5G 网络现已使得在边缘大规模部署 AI 成为可能 ...

  7. 2018年终总结之AI领域开源框架汇总

    2018年终总结之AI领域开源框架汇总 [稍显活跃的第一季度] 2018.3.04——OpenAI公布 “后见之明经验复现(Hindsight Experience Reply, HER)”的开源算法 ...

  8. 2018 AI产业界大盘点

    2018  AI产业界大盘点 大事件盘点 “ 1.24——Facebook人工智能部门负责人Yann LeCun宣布卸任 Facebook人工智能研究部门(FAIR)的负责人Yann LeCun宣布卸 ...

  9. Gradient Boosting, Decision Trees and XGBoost with CUDA ——GPU加速5-6倍

    xgboost的可以参考:https://xgboost.readthedocs.io/en/latest/gpu/index.html 整体看加速5-6倍的样子. Gradient Boosting ...

随机推荐

  1. Django_02_创建模型

    一:ORM简介 ORM,全拼Object-Relation Mapping,中文意为对象-关系映射,是随着面向对象的软件开发方法发展而产生的. 面向对象的开发方法是当今企业级应用开发环境中的主流开发方 ...

  2. 11_Redis_事务

    一:Redis 事务:目的为了进行Redis语句的批量化操作,不保证数据安全 Redis作为NoSQL数据库也同样提供了事务机制:在Redis中,MULTI/EXEC/DISCARD/这三个命令是我们 ...

  3. EasyUI中取的DataGrid中选中行数据

    dataGrid中显示列:ItemID,ItemCode,ItemName,Note 一.选中一行 var selRow = $('#dataGrid').datagrid('getSelected' ...

  4. [Web Component] Allow External Styling of a Web Component's Shadow DOM

    The Shadow DOM protects your components from style conflicts. The same protection also makes it hard ...

  5. 牛客寒假算法基础集训营2 【处女座与复读机】DP最小编辑距离【模板题】

    链接:https://ac.nowcoder.com/acm/contest/327/G来源:牛客网 一天,处女座在牛客算法群里发了一句“我好强啊”,引起无数的复读,可是处女座发现复读之后变成了“处女 ...

  6. php遍历一个文件下的所有文件和子文件夹下的文件

    function AllFile($dir){ if($dh = opendir($dir)){ while (($file = readdir($dh)) !== false){ if($file ...

  7. locate/find

    locate 从数据库 (/var/lib/mlocate/mlocate.db) 查找命令,使用updatedb更新库. 类似于数据库的索引建立,在首次简历索引的时候,很耗费资源,在建立完成后,查询 ...

  8. Python基础之基本数据类型的总结

    基本数据类型的总结 1. 按照存储空间的占用分(从低到高) 数字 字符串 集合:无序,即无序存索引相关信息 元组:有序,需要存索引相关信息,不可变 列表:有序,需要存索引相关信息,可变,需要处理数据的 ...

  9. 【java设计模式】-01设计模式简介

    简介 设计模式(Design pattern)是软件开发人员在软件开发过程中面临的一般问题的解决方案.这些解决方案是众多软件开发人员经过相当长的一段时间的试验和错误总结出来的. 设计模式是一套被反复使 ...

  10. mybatis 多级级联(多级嵌套)

    注:笔者这里的嵌套可以用词有点欠缺,忘见谅 需求:用一个查询接口查出其结果集,这里就用伪代码标识要返回前端的类与类之间的关系. class 顶层{ String otherValue; LinkedL ...