littlebot
Published on 2025-04-12 / 0 Visits
0

【源码】基于Python的工作效率提升工具集

项目简介

本项目是一个基于Python的工具集合,旨在提升工作效率。项目包含多个独立的项目和脚本,可用于快速生成项目目录结构、执行常用操作命令、填充模板代码、管理机器学习项目、调度离线任务、管理实验、定制参数、监控服务、处理离线模型、进行数据可视化、实现兴趣推荐以及自然语言处理等多个方面。这些工具可能会在适当的时候被提取划分为独立的项目。

项目的主要特性和功能

  1. 项目生成:能快速生成Python和Scala常用项目的基本目录结构。
  2. 命令操作:基于fabric保存常用的操作命令,如git提交和远程目录拷贝。
  3. 模板填充:借助Jinja2实现模板代码的快速填充,用于生成离线模型和数据监控脚本。
  4. 机器学习:提供机器学习项目的基本框架。
  5. 任务调度:基于DAG执行离线数据库任务和用户定义任务。
  6. 实验管理:支持优雅的实验管理和日志定制。
  7. 参数定制:用于用户特殊处理的参数定制类。
  8. 服务监控:可定制实际的服务监控任务。
  9. 模型管理:管理离线模型并读取到在线策略系统。
  10. 数据可视化:将DataFrame数据绘制成图表并以pdf形式输出。
  11. 兴趣推荐:构建Hive数据分析基础类和方法并应用于兴趣推荐。
  12. 自然语言处理:包括解析搜狗语料scel文件和训练lda模型。

安装使用步骤

假设用户已经下载了本项目的源码文件,以下是各工具的使用说明:

项目生成

bash ./project_maker_py.sh -p test ./project_maker_scala.sh -p test

常用命令操作

bash fab git_commit # 提交git fab scp_from_remote / scp_to_remote # 远程拷贝

模板填充

```bash usage: base_maker [-h] [-t TEMPLATES] [-c CONFPATH]

template maker

optional arguments: -h, --help show this help message and exit -t TEMPLATES, --templates TEMPLATES template names to make, should be defined as section name in conf, and have related file in templates/ folder -c CONFPATH, --confpath CONFPATH configuration path for template detail info

example: python base_maker.py -t base_template1.py,base_template2.py python base_maker.py -t templates/base_template.py -c conf/marker.conf python base_maker.py -t templates/base_template.py python base_maker.py -t base_template.py -c conf/marker.conf python base_maker.py -t base_template ```

任务调度

```bash python bin/add_task.py # 添加单个任务 python bin/suite_example.py # 添加任务组

python bin/task_manager.py ```

实验管理

python with ExpManager("Mock") as (exp, logger): from collections import OrderedDict user_info = OrderedDict(user_id=1, account_id=123, campaign_id=1234) if exp and exp.has_user(user_info): print 'user exists in exp' logger.debug('user_id[%d] account_id[%d] campaign_id[%d] participate exp' % tuple(user_info.values())) else: print 'user not exists in exp' logger.debug('user_id[%d] account_id[%d] campaign_id[%d] dont participate exp' % tuple(user_info.values()))

参数定制

python CustomSettingManager.load(xml_filename, logger) user_setting_dict = CustomSettingManager.get_user_in_custom_setting(user_id,'STATUS', logger)

服务监控

bash ./general_start.sh # for monitor run once ./crontab_start.sh # for monitor run in crontab time

数据可视化

bash python reporter.py # 结果在output/test.pdf中输出

兴趣推荐

bash python interest_recommend_cf.py --train --no-train-reload --interests "ABC" --max_interest_num 10

下载地址

点击下载 【提取码: 4003】【解压密码: www.makuang.net】