Skip to main content

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.23


前言

本参考手册详细介绍了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.7

安装依赖库

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
torch>=2.1.0+cu121

卸载

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格式的数据

    dffilename必填其中之一

  • label: str-None-

    表示用于模型训练的标签栏

    默认为df最后一列

  • filepath: str-None-

    通常是原始数据的路径地址

    dffilename必填其中之一

    目前支持: .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

onetouch.tools

printc

onetouch.tools中, 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.tools.printc(f'{123}绿色文本', list1, list2, display=True, color='green')

输出

123绿色文本 [1, 2, 3] [9, 8, 7] 

prints

onetouch.tools中, prints(self, *args, display, style, morphology, recover, sep, end, file)

选择性打印多种样式的字符到终端

参数

  • self: Any-None-

    通常是要打印在终端的内容

  • *args: tuple[Any]-None-

    通常是其他需要打印在终端的内容

  • display: bool-True-

    控制是否将内容输出到终端

  • style: str-None-

    控制将内容输出到终端的样式,绝对优先级:3

    规范化写法

      ```Python
      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.tools.prints(f'{987}测试文本', list1, list2, display=True,style='color:green;backgroundcolor:blue;', morphology=morphology, recover=True)

输出

987测试文本[1, 2, 3][9, 8, 7]

附录

pytorch参考手册

numpy参考手册

pandas参考手册

matplotlib参考手册

scikit-learn参考手册


致谢

在此,我要特别感谢智谱清言对于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

onetouch-0.1.23.tar.gz (16.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

onetouch-0.1.23-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

Details for the file onetouch-0.1.23.tar.gz.

File metadata

  • Download URL: onetouch-0.1.23.tar.gz
  • Upload date:
  • Size: 16.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.5

File hashes

Hashes for onetouch-0.1.23.tar.gz
Algorithm Hash digest
SHA256 cd16a3f5ca2d49439870e1db9a0fe5c505394bc69fd1ca282c1973e3fa8f7acb
MD5 2f1712274f5cd58befd46d7396f1d47e
BLAKE2b-256 bb0ded78d8aeae1b8b57beb6158401d72a2bbb540680aa4d5c6498e9c2e7ea2e

See more details on using hashes here.

File details

Details for the file onetouch-0.1.23-py3-none-any.whl.

File metadata

  • Download URL: onetouch-0.1.23-py3-none-any.whl
  • Upload date:
  • Size: 12.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.5

File hashes

Hashes for onetouch-0.1.23-py3-none-any.whl
Algorithm Hash digest
SHA256 cb86fc3a1803b7053669e6689485fdaec204abb3623a638237fd67e691e6f86d
MD5 a8e2ad25e737c2a03d82d57c3cc24a1d
BLAKE2b-256 c2b4f1416712bec13ada2e5511ff3babd8f30925f61ca78449e5abe57f07c923

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page