A simple and convenient Python automation toolkit based on libraries such as PyTorch, Pandas, Scikit-learn, Matplotlib, NumPy, etc., offering features like one-click data cleaning, model training, model evaluation, automatic hyperparameter tuning, and prediction.
Project description
OneTouch 一键
发布日期: 2024年10月26日
版权所有: 17fine(个人)
版本号: 0.1.32
前言
本参考手册详细介绍了OneTouch中包含的函数、模块和对象,描述了它们是什么以及它们做什么。了解如何使用OneTouch。
概述
简介
一款基于PyTorch、Pandas、Scikit-learn、Matplotlib、NumPy等库的简单便捷的Python自动化工具包,提供一键数据清洗、模型训练、模型评估、自动超参数调优和预测等功能。
A simple and convenient Python automation toolkit based on libraries such as PyTorch, Pandas, Scikit-learn, Matplotlib, NumPy, etc., offering features like one-click data cleaning, model training, model evaluation, automatic hyperparameter tuning, and prediction.
宗旨
以极简之码,绘繁复之功。
With minimalist code, depicting the intricate work.
安装指南
默认安装
pip install onetouch
指定版本安装
pip install onetouch==0.1.31
安装依赖库
pandas>=2.2.2
numpy>=1.26.4
seaborn>=0.12.2
matplotlib>=3.7.2
scikit-learn>=1.3.2
tqdm>=4.66.1
zhipuai
卸载
pip uninstall onetouch
快速入门
先决条件
在阅读本教程之前,你应该了解一些Python的基础知识。如果你想复习一下,请回去看看Python教程。
One2Three
一键三连模块使用,集成数据清洗,模型训练,评估模型三大模块
import onetouch as ot
filename = "Your FileName"
data = ot.One2Three(None, None, filename)
功能参考
onetouch
One2Three
onetouch中, One2Three(df, label, filename)
一键三连地进行数据清洗、模型训练、模型评估
参数
-
df:pd.DataFrame-None-选通常是pandas处理过后的dataframe格式的数据
df与filename必填其中之一 -
label:str-None-选表示用于模型训练的标签栏
默认为
df最后一列 -
filepath:str-None-选通常是原始数据的路径地址
df与filename必填其中之一目前支持:
.csv-.xslx
示例
import onetouch as ot
filename = "Your FileName"
data = ot.One2Three(None, None, filename)
输出
各项基本信息,不详细展开
One2Three.predict
onetouch中, One2Three.predict(x)
提供一键三连中模型预测功能
参数
-
x:pd.DataFrame-必通常是pandas处理过后的dataframe格式的数据,不含标签值
示例
import onetouch as ot
import pandas as pd
df = pd.DataFrame(None, None, 'Your filepath')
data = ot.One2Three(df)
x = pd.dataframe([1,2,3]) # 你的数据
print(data.predict(x))
输出
分类任务
-
pred:str类别标签 -
confidence:float置信度(0-1)
(pred, confidence)
回归任务
pred:float标签值
pred
printc
onetouch中, printc(self, *args, display, color, sep, end, file)
选择性打印多种颜色的字符到终端
参数
-
self:Any-None-选通常是要打印在终端的内容
-
*args:tuple[Any]-None-选通常是其他需要打印在终端的内容
-
display:bool-True-选控制是否将内容输出到终端
-
color:str-None-选控制将内容输出到终端的颜色
目前支持颜色
default:默认颜色black:黑色red:红色green:绿色yellow:黄色blue:蓝色magenta:品红色cyan:青色white:白色bright_black:灰色bright_red:亮红色bright_green:亮绿色bright_yellow:亮黄色bright_blue:亮蓝色bright_magenta:亮品红色bright_cyan:亮青色bright_white:亮白色 -
sep:str-''-选self和所有*args之间的连接符 -
end:str-'\n'-选两次printc操作之间的连接符
-
file:SupportsWrite[str]-None-选文件类对象 (stream);默认为当前的 sys.stdout。
示例
import onetouch as ot
list1 = [1, 2, 3]
list2 = [9, 8, 7]
ot.printc(f'{123}绿色文本', list1, list2, display=True, color='green')
输出
123绿色文本 [1, 2, 3] [9, 8, 7]
prints
onetouch中, prints(self, *args, display, style, morphology, recover, sep, end, file)
选择性打印多种样式的字符到终端
参数
-
self:Any-None-选通常是要打印在终端的内容
-
*args:tuple[Any]-None-选通常是其他需要打印在终端的内容
-
display:bool-True-选控制是否将内容输出到终端
-
style:str-None-选控制将内容输出到终端的样式,绝对优先级:
3规范化写法
style='color:green;backgroundcolor:blue;'
目前支持样式
`color`: 字体颜色
目前支持颜色
`default`:`默认颜色`
`black`:`黑色`
`red`:`红色`
`green`:`绿色`
`yellow`:`黄色`
`blue`:`蓝色`
`magenta`:`品红色`
`cyan`:`青色`
`white`:`白色`
`bright_black`:`灰色`
`bright_red`:`亮红色`
`bright_green`:`亮绿色`
`bright_yellow`:`亮黄色`
`bright_blue`:`亮蓝色`
`bright_magenta`:`亮品红色`
`bright_cyan`:`亮青色`
`bright_white`:`亮白色`
`backgroundcolor`: 背景颜色
目前支持颜色
`black`:`黑色`
`red`:`红色`
`green`:`绿色`
`yellow`:`黄色`
`blue`:`蓝色`
`magenta`:`品红色`
`cyan`:`青色`
`white`:`白色`
`bright_black`:`灰色`
`bright_red`:`亮红色`
`bright_green`:`亮绿色`
`bright_yellow`:`亮黄色`
`bright_blue`:`亮蓝色`
`bright_magenta`:`亮品红色`
`bright_cyan`:`亮青色`
`bright_white`:`亮白色`
`bold`: 字体加粗 - `True`/`False`
`faint`: 变暗 - `True`/`False`
`italic`: 斜体 - `True`/`False`
`underline`: 下划线 - `True`/`False`
`reverse`: 颜色反转 - `True`/`False`
`crossed-out`: 删除线 - `True`/`False`
-
morphology:dict-None-选控制将内容输出到终端的样式,绝对优先级:
2规范化写法
```Python morphology = { 'color': 'red', 'backgroundcolor': 'yellow', 'bold': True, 'faint': True, 'italic': True, 'underline': True, 'reverse': True, 'crossed-out': True } ```目前支持样式
参考onetouch.tools.printc参数style的目前支持样式 -
recover:bool-True-选是否保持该字体样式
-
sep:str-''-选self和所有*args之间的连接符 -
end:str-'\n'-选两次printc操作之间的连接符
-
file:SupportsWrite[str]-None-选文件类对象 (stream);默认为当前的 sys.stdout。
示例
import onetouch as ot
list1 = [1, 2, 3]
list2 = [9, 8, 7]
morphology = {
'color': 'red',
'backgroundcolor': 'yellow',
'bold': True,
'faint': True,
'italic': True,
'underline': True,
'reverse': True,
'crossed-out': True
}
ot.prints(f'{987}测试文本', list1, list2, display=True,style='color:green;backgroundcolor:blue;', morphology=morphology, recover=True)
输出
987测试文本[1, 2, 3][9, 8, 7]
chat_glm
onetouch中, chat(contents, api, model, stream, history)
调用智谱清言大模型的api
参数
-
contents:Any-''-选表示要询问的问题
-
api:str-None-必提供你的相应的api秘钥
-
model:str-'glm-4-flash'-选调用的大模型
-
stream:bool-False-选是否采用流式输出
-
history:list[Any]-None-选历史交互记录
示例
流式输出结果
import onetouch as ot
api = 'Your api key'
history = []
# 流式输出结果
agent = ot.chat_glm("你好,请用英文回答我", api, model='glm-4-flash', stream=True, history=history)
for content in agent:
ot.prints(content, style="color:red;", end='')
流式输出
Hello! How can I assist you today?
直接输出结果
import onetouch as ot
api = 'Your api key'
history = []
# 流式输出结果
agent = ot.chat_glm("你好,请用英文回答我", api, model='glm-4-flash', stream=False, history=history)
for content in agent:
ot.prints(content, style="color:red;", end='')
直接输出
Hello! How can I assist you today?
附录
致谢
在此,我要特别感谢智谱清言对于OneTouch库的开发与构建所做出的巨大贡献。这款软件以其高效能和智能化特性,极大地简化了开发流程,提升了库的功能性和稳定性。智谱清言的强大指导性AI大模型,让OneTouch库的构建变得更加高效和可靠。我们对智谱清言所提供的支持表示衷心的感谢,并期待在未来的项目中继续利用这一强大工具,共同推动技术的发展。
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file onetouch-0.1.32.tar.gz.
File metadata
- Download URL: onetouch-0.1.32.tar.gz
- Upload date:
- Size: 23.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73a29cf5f929d585ef90f844c0504ee48bdcc05da6269759b38135799e5bc441
|
|
| MD5 |
f29008d884e87c7eb4edec9ac6099a3c
|
|
| BLAKE2b-256 |
f6e4f8eb70627bbfe52fcaa8c0518433392c02bc22dda5da806d0df4ff7a94e0
|
File details
Details for the file onetouch-0.1.32-py3-none-any.whl.
File metadata
- Download URL: onetouch-0.1.32-py3-none-any.whl
- Upload date:
- Size: 19.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
317ff1169685ea37781e38289f751962ce89f4df99737f4573b65c95ea9967d2
|
|
| MD5 |
3fe2bb0b8e43d4bb621e5f13174700fb
|
|
| BLAKE2b-256 |
43cc3c1419dec195e2ff88cef19c6564d4011a17c0463bba8bbd02e94adbc15b
|