机器学习的时空复杂度_机器学习模型的时空复杂性

机器学习的时空复杂度

  • The train time complexity of machine learning model — The amount of time taken to train the model

    机器学习模型的训练时间复杂度 -训练模型花费的时间

  • The test time complexity of the machine learning model — Time took to predict output for a given input query point.

    机器学习模型的测试时间复杂度-预测给定输入查询点的输出所花费的时间。

Time complexity is an essential aspect to know when anyone wants their model with low latency. Let’s dive deep into details of how much time and space required by the wide variety of models to predict the output.

时间复杂度是了解何时有人想要低延迟的模型的重要方面。 让我们深入研究各种模型预测输出需要多少时间和空间。

“Assuming training data has n points with d dimensions “

“假设训练数据有n个维度为d的点”

1)K最近邻居: (1) K-Nearest Neighbors:)

Given query point (xq), K-NN follows these steps to predict output (yq). For each xi in the training set, Compute distance for xi and xq.

给定查询点(xq),K-NN遵循以下步骤来预测输出(yq)。 对于训练集中的每个xi,计算xi和xq的距离。

Image for post
https://www.edureka.co/blog/k-nearest-neighbors-algorithm/ https://www.edureka.co/blog/k-nearest-neighbors-algorithm/

Computing distance for one point takes o(d) time, as we are computing for each xi in training it takes o(nd)

计算一个点的距离需要o(d)的时间,因为我们在训练中针对每个xi进行计算都需要o(nd)

Then store the smallest k distances in a list and the Majority vote to K points, which took o(1). As we need whole train data during run time, Space complexity will be o(nd) finally for KNN

然后将最小的k个距离存储在列表中,并且将多数票投给K点,这花费了o(1)。 由于我们在运行时需要整个火车数据,因此对于KNN,空间复杂度最终将是未知的

Run Time complexity = O(nd)

运行时间复杂度= O(nd)

Space complexity = O(nd)

空间复杂度= O(nd)

There is no train time complexi

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值