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
陈乐天 Letian Chen
更新于 2024-12-05
推荐镜像 :ai4s-cup:0.3.1
推荐机型 :c2_m4_cpu
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)

#----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("When baseline is running, this error message will appear because the test set cannot be read, which is a normal phenomenon.")

# 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" # read testing setA
data_testA = pd.read_csv(testA_path)
testB_path = DATA_PATH + "a_seq_testB.csv" # 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]
#-----to save the parameters p and q to the submission.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
点个赞吧
{/**/}