机器学习特征构建_使用Streamlit构建您的基础机器学习Web应用

机器学习特征构建

Data scientist and ML experts often find it difficult to showcase their findings/result to others. Mostly ,power point or any web development tools are required to explain the results. With the introduction of Streamlit , it has become easier to develop web apps with python. We can also create multiple models and show the results based on the user selection. This comes as an easy-go hand in library specially for analyst or persons who would like to show a POC kind of solutions to the clients or to other team members. In this article, I have not detailed on the machine learning algorithms used as it is not the scope.

数据科学家和ML专家通常很难向他人展示他们的发现/结果。 通常,需要使用Power Point或任何Web开发工具来解释结果。 随着Streamlit的引入,使用python开发Web应用程序变得更加容易。 我们还可以创建多个模型并根据用户选择显示结果。 这是易于使用的资料库,专门供分析人员或想向客户或其他团队成员展示POC解决方案的人员使用。 在本文中,我没有详细介绍所使用的机器学习算法,因为它不是范围。

Streamlit is an open-source python framework that allows us to create interactive websites for machine learning and data science related requirements[1]. In this article, we will develop a web app for classification algorithm where the user will be able to select the algorithm on which the model should be built, the model parameters and visualize the corresponding results of the model.

Streamlit是一个开放源代码的python框架,允许我们创建用于机器学习和数据科学相关要求的交互式网站[1]。 在本文中,我们将开发一个用于分类算法的Web应用程序,在该应用程序中,用户将能够选择应在其上构建模型的算法,模型参数并可视化模型的相应结果。

1. Data Set :

1.数据集:

For demonstration purpose, I have taken a smaller diabetes dataset from the following link (Kaggle). The objective of the dataset is to predict whether a patient is diabetic or non-diabetic. Personally speaking, I have only explored with smaller and medium size datasets using streamlit.

为了演示,我从下面的链接( Kaggle )中获取了一个较小的糖尿病数据集。 数据集的目的是预测患者是糖尿病患者还是非糖尿病患者。 就个人而言,我仅使用streamlit探索了中小型数据集。

2. Installing Streamlit :

2.安装Streamlit:

Let us begin by installing Streamlit using the command :

让我们开始使用以下命令安装Streamlit:

pip install streamlit

点安装streamlit

Run the following command to ensure that the installation is working,

运行以下命令以确保安装正常进行,

streamlit hello

流光打招呼

To run a web app, run the command,

要运行网络应用,请运行以下命令,

streamlit run <filaname.py>

流式运行<filaname.py>

This command will open a browser, where the web app will be displayed. If any changes are made to the source file, we can dynamically observe the changes in the app by using the re-run option.

此命令将打开一个浏览器,将在其中显示Web应用程序。 如果对源文件进行了任何更改,我们可以使用re-run选项动态观察应用程序中的更改。

3. Streamlit Components:

3. Streamlit组件:

This article will discuss about the following components and how they are used in our machine learning web app,

本文将讨论以下组件以及它们在我们的机器学习网络应用中的使用方式,

• Checkbox

•复选框

• Title

•标题

• Sidebar

•侧边栏

• Markdown

•降价促销

• Selectbox (drop-box)

•选择框(下拉框)

• Multi-select

• 多选

• Radio (radio buttons)

•单选(单选按钮)

• Number Input box

•数字输入框

• Slider

•滑杆

• Caching

•缓存

• Button

•按钮

Let us now import the streamilt and other necessary libraries for our machine learning model,

现在,让我们为我们的机器学习模型导入streamilt和其他必要的库,

import streamlit as stimport pandas as pdimport numpy as npfrom sklearn.svm import SVCfrom sklearn.linear_model import LogisticRegressionfrom sklearn.ensemble import RandomForestClassifierfrom sklearn.tree import DecisionTreeClassifierfrom sklearn.preprocessing import Lab
  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值