C1W1 Lesson House Prices - import is missing keras?

I am working on this lesson and ‘from tensorflow import keras’ is not present in the import section, and also, that section is not editable, so I can’t add it.

There’s no reference in any of week 1’s materials as to how to build this solution without keras, so… I am not sure how to solve this.

Hello @raz_lagat ,

You can work without importing keras, by using : tf.keras

You cannot import anything else.
You need to code between this block only:

### START CODE HERE
....
### END CODE HERE

With regards,
Nilosree Sengupta

In the lesson, there is an instruction “# Define your model (should be a model with 1 dense layer and 1 unit)”

Since in the week’s content I did not see any reference to ‘dense’ which was not tied to keras, I took it to mean keras was needed. I believe nilosreesengupta has pointed me in the right direction, though.

Ah, I did not know you could do that. Thank you!

… I did not see any reference to tf.keras usage in week one’s content. It might be wise to either add it to the lesson content, or switch the lesson.

Hello @raz_lagat ,

You’re welcome!!

Btw, it’s there in the course.
In this video : Working through ‘Hello World’ in TensorFlow and Python

With regards,
Nilosree Sengupta

it is indeed in the lesson, however, the hello world lab notes ALSO import keras (just a couple of lines above the section in your screenshot). And the line of code from Hello World does not work in the House Pricing lesson-

model = tf.keras.Sequential([keras.layers.Dense(units=1, input_shape=[1])])

…you get the below error.

in house_model()
11
12 # Define your model (should be a model with 1 dense layer and 1 unit)
—> 13 model = tf.keras.Sequential([keras.layers.Dense(units=1, input_shape=[1])])
NameError: name ‘keras’ is not defined

Without adding “tf.” to the second instance of keras in that line of code, it will not work. This is what I meant about this not being covered in the coursework- there’s literally no mention of what to do when you haven’t imported keras.

model = tf.keras.Sequential([tf.keras.layers.Dense(units=1, input_shape=[1])])
.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,^^