Undefined behaviour while checking if a class variable contains a model

### Describe the bug

I want to check whether a class variable is None or has an actual model. When I do this with the RandomForestRegressor, it outputs a ```AttributeError: 'RandomForestRegressor' object has no attribute 'estimators_'```. 
I have tried the same code with  ```KNeighborsRegressor```and ``` DecisionTreeRegressor```, and it works perfectly fine.
I am not sure if I am writing some sketchy code or if it is an actual bug. 

### Steps/Code to Reproduce

```python
import numpy as np
from sklearn.ensemble import RandomForestRegressor
rng = np.random.RandomState(42)
X = rng.random_sample(size = (10,3))
y = rng.random_sample(size = (10,111_000))

reg_model = RandomForestRegressor() # reg_model has a default value equal to None
if not reg_model: # it works fine if I write it as   if reg_model == None
    raise ValueError("Empty model")
    
reg_model.fit(X,y)

```

### Expected Results

The model should be fitted with no issues.

### Actual Results

```
AttributeError                            Traceback (most recent call last)
/var/folders/48/24339c8s5kz5w1b69kc65hlw0000gn/T/ipykernel_86772/4046254743.py in <module>
      1 reg_model = RandomForestRegressor()
----> 2 if not reg_model:
      3     raise ValueError("Empty model")
      4 
      5 reg_model.fit(X,y)

/usr/local/Caskroom/miniconda/base/envs/tfm/lib/python3.9/site-packages/sklearn/ensemble/_base.py in __len__(self)
    178     def __len__(self):
    179         """Return the number of estimators in the ensemble."""
--> 180         return len(self.estimators_)
    181 
    182     def __getitem__(self, index):

AttributeError: 'RandomForestRegressor' object has no attribute 'estimators_'
'''

### Versions

```shell
System:
    python: 3.9.7 (default, Sep 16 2021, 08:50:36)  [Clang 10.0.0 ]
executable: /usr/local/Caskroom/miniconda/base/envs/tfm/bin/python
   machine: macOS-10.16-x86_64-i386-64bit

Python dependencies:
          pip: 21.2.4
   setuptools: 58.0.4
      sklearn: 1.0.2
        numpy: 1.22.3
        scipy: 1.8.0
       Cython: None
       pandas: 1.4.2
   matplotlib: 3.5.1
       joblib: 1.1.0
threadpoolctl: 3.1.0

Built with OpenMP: True
```

COMMENT:
It works fine when you compare it with `None` as it is not equal to `None`, it is a valid `RandomForestRegressor` instance.
Checking `if not obj` in Python does the following in this order : 
- Calls the `__nonzero__` special method if it is implemented, which returns a bool if the object is empty (not implemented in that case)
- If the non zero method is not implemented, it calls the `__len__` special method if it is implemented (it is in that case), if the length is not 0 then the condition passes (as it essentially become `if len(obj))`
- Failing that, it compares the object instance with None (`obj == None`)

Now what happened here is that the `__len__` method of `RandomForestRegressor` is inherited from its base class and is  returning the length of the estimators list (`self.estimators_`) as shown in the error message. In that case, the RandomForestRegressor is still not fitted so the `estimators_` parameter is not set, hence the error.

I'm not familiar enough with the internals of the `RandomForestRegressor` to check whether it would be better to initialise the parameter to an empty list.

Labels: Bug, Needs Triage