当前位置:网站首页>[backtrader source code analysis 7] analysis of the functions for calculating mean value, variance and standard deviation in mathsupport in backtrader (with low gold content)
[backtrader source code analysis 7] analysis of the functions for calculating mean value, variance and standard deviation in mathsupport in backtrader (with low gold content)
2022-06-13 00:49:00 【Python's path to becoming a God】
The previous articles tried to optimize backtrader Several time processing functions to improve efficiency , Use cython It can improve the efficiency of a single function, but in the whole, after the efficiency decreases and leads to failure , I tried again numba To improve those time processing functions , And I failed . At present, there is no better method to improve those time conversion functions , Which great God has a good way to help , Help each other . You can pay .
Next, this article analyzes several mathematical support functions : Average 、 variance 、 Standard deviation , On the whole, there is no gold content . In the next article , Focus on parsing a key source file :metabase.py
#!/usr/bin/env python
# -*- coding: utf-8; py-indent-offset:4 -*-
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import math
# Look at the , These functions are mainly used to calculate some indicators , Not used in the main body , Comment on , Come back later to see if you need to use cython improvement , There is no need to improve for the time being .
# But these functions can actually be considered numpy To improve the ,numpy Specific functions are provided to calculate the mean value , Calculate the standard deviation
# This calculation is the average , With a parameter bessel, Used to determine whether the value of the denominator subtracts one... When calculating the average value . Molecular use math.fsum For calculation and
def average(x, bessel=False):
'''
Args:
x: iterable with len
oneless: (default ``False``) reduces the length of the array for the
division.
Returns:
A float wi边栏推荐
- The seventh finals of the Blue Bridge Cup
- Druid reports an error connection holder is null
- Deep learning model pruning
- Rest at home today
- Make the tasks in the scheduled task XXL job flexible
- [JS component] calendar
- The grass is bearing seeds
- 深度学习模型剪枝
- Development notes of Mongoose
- 【SCA-CNN 解读】空间与通道注意力:Spatial and Channel-wise Attention
猜你喜欢

通过抓包下载钉钉直播回放

Aunt learning code sequel: ability to sling a large number of programmers

Expression tree - medium order printout

AOF持久化

(01).NET MAUI实战 建项目

MySQL lpad() and rpad() concatenate string functions with specified length

Deep learning model pruning

pytorch是什么?解释pytorch的基本概念

. The way to prove the effect of throwing exceptions on performance in. Net core

Hard (magnetic) disk (II)
随机推荐
Kotlin 协程的四种启动模式
[JS component library] drag sorting component
Build your own PE manually from winpe of ADK
Programming training 1
OceanBase 雄踞墨天轮2021年度中国数据库魔力象限领导者
Through MDC, you can easily track your scheduled task log
Androi天氣
三栏简约typecho主题Lanstar/蓝星typecho主题
Triangle wave and triangle wave convolution
What are the conditions of index invalidation?
磁盘分区方式对比(MBR与GPT)
Learning and Development notes of mongdb
Download nail live playback through packet capturing
Paper reading and sharing
Kotlin 协程,job的生命周期
AOF持久化
[server data recovery] successful cases of data loss recovery during data migration between storage servers
Expression tree - medium order printout
Some basic design knowledge
What is meebits? A brief explanation