python如何创建目录失败_无法在python中创建目录

我对python没有太多的经验,但是我尝试了一些方法,但是对于这个错误还没有任何效果:InvalidArgumentError: Failed to create a directory: ./logsSat Jun 9

20:44:37 2018-training; Invalid argument

它发生在代码的一个简单部分,即创建一个文件来存储来自sklearn数据集的数据。以下是代码的一部分:epochs = 500

logpath = './logs'

resultpath = './results'

def main(epochs, logpath, resultpath):

# load the features of the dataset

features = datasets.load_breast_cancer().data

# standardize the features

features = StandardScaler().fit_transform(features)

# get the number of features

num_features = features.shape[1]

# load the labels for the features

labels = datasets.load_breast_cancer().target

train_features, test_features, train_labels, test_labels = train_test_split(features, labels, test_size=0.20,

stratify=labels)

model = MLP.MLP(alpha=LEARNING_RATE, batch_size=BATCH_SIZE, node_size=NUM_NODES, num_classes=NUM_CLASSES,

num_features=num_features)

model.train(num_epochs=epochs, log_path=logpath, train_data=[train_features, train_labels],

train_size=train_features.shape[0], test_data=[test_features, test_labels],

test_size=test_features.shape[0], result_path=resultpath)

显然,'/logs'不是我应该如何输入该目录名的,所以有什么想法可以让它工作吗?我尝试过只使用目录名、完整路径和系统路径追加(“.”)语法,但我一直得到相同的错误。在

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值