ageron / ageron/handson-ml

Value Error in Chapter 2

Open
#347 6 comments 2 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
25.6k
Forks
12.7k
PR merge metrics
No merged PRs in 30d

Description

I am following the code as per notebook and i am getting some dimension error in cell [81]:

```python
# let's try the full preprocessing pipeline on a few training instances

some_data = housing.iloc[:5]
some_labels = housing_labels.iloc[:5]
some_data_prepared = full_pipeline.transform(some_data)

print("Predictions:", lin_reg.predict(some_data_prepared))
```

```
ValueError: shapes (5,14) and (16,) not aligned: 14 (dim 1) != 16 (dim 0)
```

But when i try with the following code it is working fine:

```python
# let's try the full preprocessing pipeline on a few training instances

some_data = housing.iloc[:5]
some_labels = housing_labels.iloc[:5]
#some_data_prepared = full_pipeline.transform(some_data)
some_data_prepared = housing_prepared[:5]
print("Predictions:", lin_reg.predict(some_data_prepared))
```

Please help me getting this.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.