Git Product home page Git Product logo

pcp's People

Contributors

akustiker avatar alfredocarella avatar boisgera avatar fzalkow avatar meinardmueller avatar sebastianrosenzweig avatar yiitozer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

pcp's Issues

String Formatting

In the recent versions of the Python documentation, the options that are emphasized for string formatting are:

  1. formatted string literal (f-strings),
  2. str.format method,
  3. string slicing and concatenation

The printf-style %-based method is only briefly mentionned and referred to as "old-style formatting". (See https://docs.python.org/3/tutorial/inputoutput.html#formatted-string-literals.)

While the feature is not formally deprecated, I'd rather have students learn f-strings instead of printf-style formatting, as in:

>>> string = f'x = {x}'

(I would not use the recent syntax string = f'{x = }' in such a course, but YMMV). Of course, since this preparation course is not meant to be comprehensive, if the f-string approach is considered too heavy, the 3rd option (concatenation) could be an option too:

>>> string = 'x = ' + str(x)

Conda environment issue

Problem description:
Binder fails building our environment with the following error:
package nbconvert-5.6.0-py27_1 requires python >=2.7,<2.8.0a0, but none of the providers can be installed

This is strange because we fix python=3.7.* in our environment, but it seems to load a python=2.7 version of the package.

Matrices, Vectors and Arrays

Unit 3 states that row vectors and columns vectors are special cases of matrices (with either 1 column or 1 row). While this is also how I see things, however idiomatic NumPy code would probably represent matrices as 2D arrays but row and column vectors as 1D arrays. The same object can then be interpreted and used as a row or column vector in different contexts.

Instead of

>>> A = np.array([[0, 1], [2, 3]])
>>> x = np.array([[4], [5]])
>>> y = np.array([[6, 7]])
>>> np.dot(A, x)
array([[ 5],
       [23]])
>>> y.dot(A)
array([[14, 27]])
>>> np.dot(y, A)
array([[14, 27]])
>>> np.dot(y, x)
array([[59]])
>>> np.dot(x, y)
array([[24, 28],
       [30, 35]])

one would generally do

>>> A = np.array([[0, 1], [2, 3]])
>>> x = np.array([4, 5])
>>> y = np.array([6, 7])
>>> np.dot(A, x)
array([ 5, 23])
>>> np.dot(y, A)
array([14, 27])
>>> np.dot(y, x)
59
>>> np.outer(x, y)
array([[24, 28],
       [30, 35]])

I'd rather see that latter kind of idiom used (and have the solution of exercise 2 updated accordingly).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.