Wednesday, January 25, 2023

How to program in R language in Jupyter Notebooks using Conda environments



In this blog post, we will discuss how to use conda environments to install the R kernel and program in R in Jupyter notebooks.

1. Install conda

The first step in using conda environments is to install conda itself. You can download the conda installer from the Anaconda website and follow the instructions to install it on your system. Once you have conda installed, you can create and manage virtual environments.

2. Create a new conda environment

To create a new conda environment, you can use the following command in your terminal:

conda create -n myrenv

This will create a new environment called "myenv" that you can use to manage your packages and dependencies. You can activate this environment by using the following command:

conda activate myrenv

3. Install the R kernel

Now that you have an active conda environment, you can use it to install the R kernel. You can do this by using the following command (you may have to press Enter key several times to finish the process):

conda install -c r r-irkernel

This will install the R kernel in your active conda environment and make it available in Jupyter notebooks.

4. Install R packages

Once the R kernel is installed, you can install conda to install any R packages you need for your project. For example, if you need the dplyr package, you can use the following command:

conda install -c r r-dplyr

You can also use the install.packages() function in your R code, but you should run it in the same conda environment where you installed the R kernel.

5. Run R code in Jupyter notebook

Now that you have the R kernel installed and your packages ready, you can install Jupyter notebook and select the R kernel to run your R code. 

You can install Jupyter Notebooks by running:

conda install jupyter

You can open Jupyter notebooks from this environment by running:

jupyter notebook

You can use all the features of Jupyter notebook, such as markdown, code execution, visualization and more.

By using conda environments to manage your dependencies and packages, you can ensure that your projects are consistent and reproducible. This is especially useful when working in teams or sharing your code. Remember that you can always export and import the environment file to share with others, so they can recreate the same environment and run your code without any issues.

Conda environments are a powerful tool for managing your dependencies and packages in Jupyter notebooks. Following the steps outlined in this blog post, you can easily install the R kernel and program in R in Jupyter notebooks with confidence and consistency.


Friday, November 5, 2021

Webinar Series on Smart Grid and Microgrids by Smart Grid Research Lab, University of Moratuwa

This webinar series is created by the Smart Grid Research Lab of the University of Moratuwa, Sri Lanka. As a research assistant and a Ph.D. student, I had the honor of organizing the series. 

The webinar series is titled "Discussion forum on Smart Grid and Microgrids". It will cover the fundamentals of Smart Grid and Microgrids and the research areas of Smart Grid Research Lab.

The webinars will be uploaded to YouTube and created as a playlist.

Check out the introduction to the webinar series and the lab by Prof. K. T. M. U. Hemapala.



Monday, August 23, 2021

Definition of a Microgrid

The microgrid is a concept that is modernizing the conventional power system in many countries. It was first proposed in the early 2000s and a lot of research from academia and industry has been conducted to improve the concept as well as the technologies required. Here the definitions of the microgrid are given.

USA Department of Energy (DOE) definition (Ton & Smith, 2012):

"A group of interconnected loads and distributed energy resources within clearly defined electrical boundaries that acts as a single controllable entity with respect to the grid. A microgrid can connect and disconnect from the grid to enable it to operate in both grid-connected or island mode."

European Union (EU) Research Projects definition (Schwaegerl & Tao, 2013):

"Microgrids comprise LV distribution systems with distributed energy resources (DER) (microturbines, fuel cells, PV, etc.) together with storage devices (flywheels, energy capacitors, and batteries) and flexible loads. Such systems can be operated in a non-autonomous way, if interconnected to the grid, or in an autonomous way, if disconnected from the main grid. The operation of micro sources in the network can provide distinct benefits to the overall system performance, if managed and coordinated efficiently."

From these definitions, the USA DOE definition is widely used in many research and industry literature and projects.

References

Schwaegerl, C., & Tao, L. (2013). The Microgrids Concept. In Microgrids (pp. 1–24). Chichester, United Kingdom: John Wiley and Sons Ltd.

Ton, D. T., & Smith, M. A. (2012). The U.s. department of energy’s microgrid initiative. Electricity Journal, 25(8), 84–94.


Thursday, July 8, 2021

A new page for Machine Learning resources


I have created a page to curate Machine Learning resources found on the internet
. Most of these resources are freely available to anyone. Following lists are created as a start.

Also, you'll find similar lists in this link - dair-ai/ML-YouTube-Courses

Researchers to follow

Content to follow

Tuesday, December 22, 2020

Research on Machine Learning applications in Smart Grid & Microgrids

Smart grids and microgrids are the future of the power system we use today. Integrating the power systems with communication devices and adding a data layer has its perks for power system operators as well as the consumers. 

This novel power system will generate enormous amounts of data with its maturity. As researchers, it is quite fascinating for us since this means that we get to combine two disciplines, Machine Learning & Power Systems.

In this blog post, I will list all the possible applications that I come across of machine learning in power systems.

Update: I will start to categorize them into,

  • Microgrid research
  • Energy forecasting
  • Smart grid research

Microgrid research
  • Multi-agent systems for microgrid control [link]
  • Reinforcement learning for microgrid energy management
  • Detect security breaches
  • Fault detection and classification
  • Microgrid islanding detection
  • Multi-agent reinforcement learning for microgrid control
Energy forecasting research
  • Solar energy forecasting / Solar irradiation forecasting
  • Power system demand forecasting
Smart grid research
  • Detect security breaches
  • Fault detection and classification
  • Data compression in smart grids [link]

Tuesday, November 3, 2020

Studying Machine Learning and Deep Learning from Scratch

I was interested in learning machine learning and deep learning ever since I realized its potential to apply to many research problems in power systems research. So I started learning it. So far, I have done one Coursera specialization, a course (you can probably guess this) and I'm currently doing another specialization. Before this, I went through several youtube videos to get a feel for what ML really is.

Apart from this, I'm enrolled in the program by Dr. Michal Fabinger @Tokyo Data Science

My goal here is to recommend the flow of this process, which would have been very helpful in the beginning for me. Although I have given Coursera links most of the content is available open-source for free. So here it goes,

Also, there are several others I have planned to do in the coming months which are on ML tools.
That's it for now. I'm sure there are others that are good resources but here I'm giving you my own path. Feel free to comment with your own suggestions.