铅酸蓄电池的等效数学模型_酸洗机学习模型

本文探讨了铅酸蓄电池的等效数学模型,深入解析了其工作原理,并引用了一篇关于如何利用Python进行机器学习模型的保存与加载的文章。
摘要由CSDN通过智能技术生成

铅酸蓄电池的等效数学模型

After you create a machine learning model, you train it. The training process usually takes some time. After the model is trained, what you get is the model object. To use the model, you can either somehow save that model or you can retrain the model every time you use it, which is inefficient).

创建机器学习模型后,您将对其进行训练。 培训过程通常需要一些时间。 训练模型后,您将获得模型对象。 要使用模型,可以以某种方式保存该模型,也可以在每次使用模型时对其进行重新训练,这效率很低)。

If you have terabytes of training data for a model, every time you want to make a prediction, it would be inefficient to train the model each time. Instead, after training the model, you can save it. You should ideally retrain the model once you have new data, but you don’t have to retrain it every time you want to use it.

如果您有TB的模型训练数据,则每次要进行预测时,每次训练模型的效率都会很低。 相反,在训练模型后,您可以保存它。 理想情况下,一旦有了新数据,就应该对模型进行重新训练,但不必每次都想使用它时就对其进行重新训练。

To save a machine learning model, use pickle.

要保存机器学习模型,请使用pickle

什么是酸洗? (What Is Pickling?)

Pickle is a module in Python used for serializing and de-serializing Python objects. This converts Python objects like lists, dictionaries, etc. into byte streams (zeroes and ones). You can convert the byte streams back into Python objects through a process called unpickling. Pickling is also known as serialization, flattening, or marshalling.

Pickle是Python中的一个模块,用于对Python对象进行序列化和反序列化。 这会将列表,字典等Python对象转换为字节流(零和一)。 您可以通过一个称为解包的过程将字节流转换回Python对象。 酸洗也称为序列化,展平或编组。

如何腌制 (How to Pickle)

The pickle module has two methods.

泡菜模块有两种方法。

泡菜。 倾倒() (pickle.dump())

The pickle.dump() method dumps the Python object in the pickle file. This creates a .pickle file in your current working directory (pickle.dump(what_are_we_dumping, where_are_we_dumping_it)):

pickle.dump()方法将Python对象转储到pickle文件中。 这会在您当前的工作目录( pickle.dump(what_are_we_dumping, where_are_we_dumping_it) )中创建一个.pickle文件:

import pickle


example_dict = {1:"Australia", 2:"Belgium", 3:"Canada", 4:"Denmark"}


#statement 1
with open('example_dict.pickle', 'wb') as pickle_out:
  pickle.dump(example_dict, pickle_out)
  
#statement 2 
pickle_out = open("example_dict.pickle", "wb")
pickle.dump(example_dict, pickle_out)
pickle_out.close()

In the code snippet above, we are creating an example_dict.pickle file from an example_dict dictionary. Statements 1 and 2 perform the same task of converting the dictionary into a pickle file. Using the with statement ensures that open file descriptors are closed automatically after the program ex

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值