Bohrium
robot
新建

空间站广场

论文
Notebooks
比赛
课程
Apps
我的主页
我的Notebooks
我的知识库
我的足迹

我的工作空间

任务
节点
文件
数据集
镜像
项目
数据库
公开
2025 AI4S TEEN Cup Challenge Math——Parameter Solving of Recursive Sequence_baseline
2025 AI4S TCC Ma
python
2025 AI4S TCC Mapython
郑子杰 Zijie Zheng
01
更新于 2024-12-05
推荐镜像 :ai4s-cup:0.3.1
推荐机型 :c2_m4_cpu
14
3
rain(v1)
[3]
import numpy as np
from matplotlib import pyplot as plt
import pandas as pd
import torch
import torch.nn as nn
import torch.optim as optim
import os

# 定义回归模型(需要选手自己设计填写)
# Define the regression model (participants need to design and fill it in themselves)

# 进行回归的函数(需要选手自己设计填写)
# Function for parameter solving (participants need to design and fill it in themselves)
def pqregression(data):
p_value = 1
q_value = 1
return p_value, q_value
代码
文本
[ ]
if __name__ == '__main__':
#-------------读取训练集,训练集地址已经设定好,下面这段不用修改------------------#
#-----Read the training set, the address of the training set has been set, and the following section does not need to be modified-------#
train_path = "/bohr/train-btk3/v1/a_seq_train.csv"
data_train = pd.read_csv(train_path)

#-------------读取测试集---------------#“DATA_PATH”是测试集加密后的环境变量,按照如下方式可以在提交后,系统评分时访问测试集,但是选手无法直接下载
#----Read the testing set, “DATA_PATH” is an environment variable for the encrypted test set. After submission, you can access the test set for system scoring in the following manner, but the contestant cannot download it directly.-----#
if os.environ.get('DATA_PATH'):
DATA_PATH = os.environ.get("DATA_PATH") + "/"
else:
print("Baseline运行时,因为无法读取测试集,所以会有此条报错,属于正常现象")
print("When baseline is running, this error message will appear because the test set cannot be read, which is a normal phenomenon.")
#Baseline运行时,因为无法读取测试集,所以会有此条报错,属于正常现象
#When baseline is running, this error message will appear because the test set cannot be read, which is a normal phenomenon.
testA_path = DATA_PATH + "a_seq_testA.csv" #读取测试集A, read testing setA
data_testA = pd.read_csv(testA_path)
testB_path = DATA_PATH + "a_seq_testB.csv" #读取测试集B,read teseting setB
data_testB = pd.read_csv(testB_path)
#--------------开始进行模型回归--Start Parameter Solving-------------#
p_train, q_train = pqregression(data_train)
p_testA, q_testA = pqregression(data_testA)
p_testB, q_testB = pqregression(data_testB)
p = [p_train,p_testA,p_testB]
q = [q_train,q_testA,q_testB]
#-----保存参数p,q到CSV文件到submission.csv, to save the parameters p and q to the .csv file-----#
df_params = pd.DataFrame({'p': p, 'q': q})
print(df_params)
csv_file_path = 'submission.csv'
df_params.to_csv(csv_file_path, index=False)
代码
文本
2025 AI4S TCC Ma
python
2025 AI4S TCC Mapython
点个赞吧
{/**/}