Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Learning NumPy Array
  • Toc
  • feedback
Learning NumPy Array

Learning NumPy Array

By : Ivan Idris
4 (9)
close
Learning NumPy Array

Learning NumPy Array

4 (9)
By: Ivan Idris

Overview of this book

Table of Contents (14 chapters)
close
Learning NumPy Array
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using more robust statistics


We can make our code from the The time-dependent temperature mean adjusted autoregressive model section more robust by doing the following:

  • Computing the median instead of the mean

    avgs[i-1] = np.median(temp[indices])
  • Ignoring the outliers with a masked array

    temp[:cutoff] = ma.masked_array(temp[:cutoff], temp[:cutoff] < (q1 - 1.5 * irq))

We get slightly different output with the modified code, with about 70 percent of the values predicted having an absolute error of less than 2 degrees Celsius:

AR params [ 0.95095073 -0.17373633]
% delta less than 2 70.8567244325

Unlock full access

Continue reading for free

A Packt free trial gives you instant online access to our library of over 7000 practical eBooks and videos, constantly updated with the latest in tech
bookmark search playlist font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete