暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

小白学大模型:Code Interpreter与AutoML

Coggle数据科学 2024-04-24
450

https://platform.openai.com/docs/assistants/tools/code-interpreter

代码解释器(Code Interpreter)允许在一个受保护的执行环境中编写和运行Python代码。这个工具可以处理具有不同数据和格式的文件,并生成包含数据和图形图像的文件。代码解释器允许您的助手迭代地运行代码,以解决具有挑战性的代码和数学问题。当您的助手编写的代码无法运行时,它可以通过尝试运行不同的代码来迭代这个过程,直到代码成功执行。

Code Interpreter的收费标准是每个会话0.03美元。如果在两个不同的线程中同时调用Code Interpreter(例如,每个终端用户一个线程),则会创建两个Code Interpreter会话。每个会话默认为一小时有效,这意味着如果用户在同一线程中与Code Interpreter交互时间不超过一小时,则只需支付一个会话费用。

使用案例如下,通过OpenAI的客户端,可以上传本地文件并进行分析:

# Upload a file with an "assistants" purpose
file = client.files.create(
  file=open("mydata.csv""rb"),
  purpose='assistants'
)

# Create an assistant using the file ID
assistant = client.beta.assistants.create(
  instructions="You are a personal math tutor. When asked a math question, write and run code to answer the question.",
  model="gpt-4-turbo",
  tools=[{"type""code_interpreter"}],
  tool_resources={
    "code_interpreter": {
      "file_ids": [file.id]
    }
  }
)

thread = client.beta.threads.create(
  messages=[
    {
      "role""user",
      "content""I need to solve the equation `3x + 11 = 14`. Can you help me?",
      "attachments": [
        {
          "file_id": file.id,
          "tools": [{"type""code_interpreter"}]
        }
      ]
    }
  ]
)

unsetunsetCode Interpreter 与 AutoMLunsetunset

Code Interpreter是一个非常适合用来进行运行代码的过程,结合AutoML则可以不断尝试新的特征,并获取更好的模型精度。

https://arxiv.org/pdf/2305.03403.pdf

CAAFE是一种利用大型语言模型将领域知识纳入特征工程过程的方法,为自动化数据科学任务提供了一个有前途的方向。

在每个循环中,LLM首先生成代码,然后在当前的训练集和验证集上执行这些代码,如果超过了之前在性能,那么我们就保留这次生成的特征。

其中包含的提示词如下:

  • 用户生成的数据集描述
  • 基于特征名称增加了背景信息
  • 数据类型
  • 缺失值的百分比
  • 数据集中随机选取的10行数据

代码精度对比


样例代码展示



 学习大模型 & 讨论Kaggle  #

△长按添加竞赛小助手

每天大模型、算法竞赛、干货资讯

与 36000+来自竞赛爱好者一起交流~


文章转载自Coggle数据科学,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论