"Python" Machinelearning Machine Learning Introduction _ Efficiency Comparison

Source: Internet
Author: User

Efficiency comparison:

It's a cliché, but this time with a new module,

Run Time Test Module Timeti:

1 ImportTimeit2 3normal = Timeit.timeit ('sum (x*x for x in range )', number=10000)4NATIVE_NP = Timeit.timeit ('sum (na*na)',#Repeating part5setup="import numpy as np; na = Np.arange (+)",#Setup runs only once6number=10000)#Number of repetitions7GOOD_NP = Timeit.timeit ('Na.dot (NA)',8setup="import numpy as np; na = Np.arange (+)",9number=10000)Ten  One Print('Native Run time:', Normal,'\ n', A       'Original NumPy run time:', NATIVE_NP,'\ n', -       'use the NumPy to bring your own function:', GOOD_NP)
Native run time:     1.236690534016816  original NumPy run time: 1.1835122400079854  using NumPy self-function: 0.02045012399321422

"Python" Machinelearning Machine Learning Introduction _ Efficiency Comparison

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.