Learn practical skills, build real-world projects, and advance your career
import numpy as np
dataset_clima = np.array([[45, 34, 34],
                         [23, 34, 12],
                         [121, 232, 45],
                          [22, 34, 12],
                          [56, 78, 97]])

weights = np.array([0.9, 0.45, 0.56])

print(dataset_clima)
print(weights)
print(type(dataset_clima), type(weights))
[[ 45 34 34] [ 23 34 12] [121 232 45] [ 22 34 12] [ 56 78 97]] [0.9 0.45 0.56] <class 'numpy.ndarray'> <class 'numpy.ndarray'>
#questo comando ci fornisce informazioni relative alla dimensione degli array, guarda foglio due su drive. è di due dimensioni 5 righe e 3 colonne
dataset_clima.shape
(5, 3)
weights.shape #è di una dimensione, 4 valori
(3,)
np.matmul(dataset_clima, weights) #comando per il prodotto tra matrici
array([ 74.84,  42.72, 238.5 ,  41.82, 139.82])
dataset_clima @ weights #comando alternativo per il prodotto tra matrici
array([ 74.84,  42.72, 238.5 ,  41.82, 139.82])