Over sampling

from imblearn.over_sampling import RandomOverSampler

ros = RandomOverSampler(random_state=42)

x_ros, y_ros = ros.fit_resample(XY.iloc[:, :-1], XY.loc[:, 'label'])
print('Original dataset shape:', Counter(y))
print('Original dataset shape:', Counter(y_ros))

XY = pd.concat([x_ros, y_ros], axis=1)

Using pipenv in Jupyter Notebook

Ipykernel is the Python execution backend for Jupyter. Jupyter Notebook automatically ensures that Ipykernel is available but if I want to use a kernel in a virtual environment, I need to install it manually. (Read)

1. Install ipykernel in the project folder where my pipfile is located.

pipenv install ipykernel

2. Start the virtual environment.

pipenv shell

This will launch the virtual environment of the project.

(my-virtualenv-name) $

3. Install Python kernel with a name

python3 -m ipykernel install --user --name=my-virtualenv-name

In my case, I used ml-basics for my virtual env name.


You can now see the kernel name ml-basics in the kernel option.


Source: SlackOverflow



Getting ready


Trying YOLO

Trying YOLO with your own data

An Intuitive Explanation of Convolutional Neural Networks

The PASCAL Visual Object Classes Homepage


What is MPC and what are the limitations of MPC

MPC (Model predictive control)

  • Key features
    • Process control that relies on dynamic models of the precesses, most often empirical models obtained by system identification
    • Represent the behaviour of complex dynamic systems


  • Main advantage
    • Optimizing the current time slot while keeping future time slots into account. This is achieved by optimizing a finite time-horizon, not only the current time slot.
    • MPC has the predictive ability to anticipate future events, which PID and LQR do not have.


  • Limitations
    • Performance
    • Model mismatch, imperfect predictions of disturbances
  • Installation & maintenance cost
    • Installation generally requires weeks or months of plant tests, controller building, and post-installation tuning
    • Maintenance
      • Just measuring controller performance is challenging
        • Harris Controller Performance Index is strictly speaking only applicable for the SISO (Single Input Single Output) case
        • Extensions to multivariable control have been proposed, but they are difficult to apply, and some of the underlying assumptions of these techniques are not realized in practice.
        • Tools for determining which of the models (of the tens or hundreds) may be in error are primitive or non-existent, and a common procedure is to simply retest the entire plant (at significant cost) whenever the performance falters too much.
      • Determining whether the controller is driving the plant to the true optimum can also be difficult
      • Lifetime cost for maintenance is high
  • Structural limitation
    • There is no guarantee that the (somewhat arbitrary) mathematical optimizations of MPC translate well into engineering objectives, nor that the rigid structure of MPC controllers matches the engineering design problem at hand.
  • Operator interference
    • Actually, MPC need more interference of operators to check if it is operating adequately
    • Model mismatch, unable to react to unexpected disturbances or differences from design cases


Source: http://www.controlartsinc.com/Support/Articles/LimitationsOfMBC.pdf