Trending March 2024 # Tensorboard Tutorial: Tensorflow Graph Visualization # Suggested April 2024 # Top 4 Popular

You are reading the article Tensorboard Tutorial: Tensorflow Graph Visualization updated in March 2024 on the website We hope that the information we have shared is helpful to you. If you find the content interesting and meaningful, please share it with your friends and continue to follow and support us for the latest updates. Suggested April 2024 Tensorboard Tutorial: Tensorflow Graph Visualization

What is TensorBoard?

TensorBoard is the interface used to visualize the graph and other tools to understand, debug, and optimize the model. It is a tool that provides measurements and visualizations for machine learning workflow. It helps to track metrics like loss and accuracy, model graph visualization, project embedding at lower-dimensional spaces, etc.

TensorFlow Graph Visualization using Tensorboard Example

The image below comes from the TensorBoard graph you will generate in this TensorBoard Tutorial. It is the main panel:

TensorFlow Graph Visualization

From the picture below, you can see the panel of TensorBoard graph visualization. The panel contains different tabs, which are linked to the level of information you add when you run the model.

TensorBoard Graphs

Scalars: Show different useful information during the model training

Graphs: Show the model

Histogram: Display weights with a histogram

Distribution: Display the distribution of the weight

Projector: Show Principal component analysis and T-SNE algorithm. The technique used for dimensionality reduction

During this TensorBoard Tutorial, you will train a simple deep learning model. You will learn how it works in a future tutorial.

If you look at the graph, you can understand how the model work.

Enqueue the data to the model: Push an amount of data equal to the batch size to the model, i.e., Number of data feed after each iteration

Feed the data to the Tensors

Train the model

Display the number of batches during the training. Save the model on the disk.

The basic idea behind tensorboard is that neural network can be something known as a black box and we need a tool to inspect what’s inside this box. You can imagine tensorboard as a flashlight to start dive into the neural network.

It helps to understand the dependencies between operations, how the weights are computed, displays the loss function and much other useful information. When you bring all these pieces of information together, you have a great tool to debug and find how to improve the model.

To give you an idea of how useful the TensorBoard graph can be, look at the picture below:

TensorBoard graph

A neural network decides how to connect the different “neurons” and how many layers before the model can predict an outcome. Once you have defined the architecture, you not only need to train the model but also a metrics to compute the accuracy of the prediction. This metric is referred to as a loss function. The objective is to minimize the loss function. In different words, it means the model is making fewer errors. All machine learning algorithms will repeat many times the computations until the loss reaches a flatter line. To minimize this loss function, you need to define a learning rate. It is the speed you want the model to learn. If you set a learning rate too high, the model does not have time to learn anything. This is the case in the left picture. The line is moving up and down, meaning the model predicts with pure guess the outcome. The picture on the right shows that the loss is decreasing over iteration until the curve got flatten, meaning the model found a solution.

TensorBoard is a great tool to visualize such metrics and highlight potential issues. The neural network can take hours to weeks before they find a solution. TensorBoard updates the metrics very often. In this case, you don’t need to wait until the end to see if the model trains correctly. You can open TensorBoard to check how the training is going and make the appropriate change if necessary.

How to use TensorBoard?

In this tutorial, you will learn how to open TensorBoard from the terminal for MacOS and the Command line TensorBoard for Windows.

The code will be explained in a future tutorial, the focus here is on TensorBoard.

First, you need to import the libraries you will use during the training

## Import the library import tensorflow as tf import numpy as np

You create the data. It is an array of 10000 rows and 5 columns

X_train = (np.random.sample((10000,5))) y_train = (np.random.sample((10000,1))) X_train.shape Output (10000, 5)

The codes below transform the data and create the model.

Note that the learning rate is equal to 0.1. If you change this rate to a higher value, the model will not find a solution. This is what happened on the left side of the above picture.

During most of the TensorFlow tutorials, you will use TensorFlow estimator. This is TensorFlow API that contains all the mathematical computations.

To create the log files, you need to specify the path. This is done with the argument model_dir.

In the TensorBoard example below, you store the model inside the working directory, i.e., where you store the notebook or python file. Inside this path, TensorFlow will create a folder called train with a child folder name linreg.

feature_columns = [ tf.feature_column.numeric_column('x', shape=X_train.shape[1:])] DNN_reg = tf.estimator.DNNRegressor(feature_columns=feature_columns, # Indicate where to store the log file model_dir='train/linreg', hidden_units=[500, 300], optimizer=tf.train.ProximalAdagradOptimizer( learning_rate=0.1, l1_regularization_strength=0.001 ) ) Output INFO:tensorflow:Using default config.

The last step of this TensorFlow visualize graph example consists to train the model. During the training, TensorFlow writes information in the model directory.

# Train the estimator train_input = tf.estimator.inputs.numpy_input_fn( x={"x": X_train}, y=y_train, shuffle=False,num_epochs=None) DNN_reg.train(train_input,steps=3000) Output INFO:tensorflow:Calling model_fn. INFO:tensorflow:Done calling model_fn. INFO:tensorflow:Create CheckpointSaverHook. INFO:tensorflow:Graph was finalized. INFO:tensorflow:Running local_init_op. INFO:tensorflow:Done running local_init_op. INFO:tensorflow:Saving checkpoints for 1 into train/linreg/model.ckpt. INFO:tensorflow:loss = 40.060104, step = 1 INFO:tensorflow:global_step/sec: 197.061 INFO:tensorflow:loss = 10.62989, step = 101 (0.508 sec) INFO:tensorflow:global_step/sec: 172.487 INFO:tensorflow:loss = 11.255318, step = 201 (0.584 sec) INFO:tensorflow:global_step/sec: 193.295 INFO:tensorflow:loss = 10.604872, step = 301 (0.513 sec) INFO:tensorflow:global_step/sec: 175.378 INFO:tensorflow:loss = 10.090343, step = 401 (0.572 sec) INFO:tensorflow:global_step/sec: 209.737 INFO:tensorflow:loss = 10.057928, step = 501 (0.476 sec) INFO:tensorflow:global_step/sec: 171.646 INFO:tensorflow:loss = 10.460144, step = 601 (0.583 sec) INFO:tensorflow:global_step/sec: 192.269 INFO:tensorflow:loss = 10.529617, step = 701 (0.519 sec) INFO:tensorflow:global_step/sec: 198.264 INFO:tensorflow:loss = 9.100082, step = 801 (0.504 sec) INFO:tensorflow:global_step/sec: 226.842 INFO:tensorflow:loss = 10.485607, step = 901 (0.441 sec) INFO:tensorflow:global_step/sec: 152.929 INFO:tensorflow:loss = 10.052481, step = 1001 (0.655 sec) INFO:tensorflow:global_step/sec: 166.745 INFO:tensorflow:loss = 11.320243, step = 1101 (0.600 sec) INFO:tensorflow:global_step/sec: 161.854 INFO:tensorflow:loss = 9.603306, step = 1201 (0.619 sec) INFO:tensorflow:global_step/sec: 179.074 INFO:tensorflow:loss = 11.110269, step = 1301 (0.556 sec) INFO:tensorflow:global_step/sec: 202.776 INFO:tensorflow:loss = 11.929443, step = 1401 (0.494 sec) INFO:tensorflow:global_step/sec: 144.161 INFO:tensorflow:loss = 11.951693, step = 1501 (0.694 sec) INFO:tensorflow:global_step/sec: 154.144 INFO:tensorflow:loss = 8.620987, step = 1601 (0.649 sec) INFO:tensorflow:global_step/sec: 151.094 INFO:tensorflow:loss = 10.666125, step = 1701 (0.663 sec) INFO:tensorflow:global_step/sec: 193.644 INFO:tensorflow:loss = 11.0349865, step = 1801 (0.516 sec) INFO:tensorflow:global_step/sec: 189.707 INFO:tensorflow:loss = 9.860596, step = 1901 (0.526 sec) INFO:tensorflow:global_step/sec: 176.423 INFO:tensorflow:loss = 10.695, step = 2001 (0.567 sec) INFO:tensorflow:global_step/sec: 213.066 INFO:tensorflow:loss = 10.426752, step = 2101 (0.471 sec) INFO:tensorflow:global_step/sec: 220.975 INFO:tensorflow:loss = 10.594796, step = 2201 (0.452 sec) INFO:tensorflow:global_step/sec: 219.289 INFO:tensorflow:loss = 10.4212265, step = 2301 (0.456 sec) INFO:tensorflow:global_step/sec: 215.123 INFO:tensorflow:loss = 9.668612, step = 2401 (0.465 sec) INFO:tensorflow:global_step/sec: 175.65 INFO:tensorflow:loss = 10.009649, step = 2501 (0.569 sec) INFO:tensorflow:global_step/sec: 206.962 INFO:tensorflow:loss = 10.477722, step = 2601 (0.483 sec) INFO:tensorflow:global_step/sec: 229.627 INFO:tensorflow:loss = 9.877638, step = 2701 (0.435 sec) INFO:tensorflow:global_step/sec: 195.792 INFO:tensorflow:loss = 10.274586, step = 2801 (0.512 sec) INFO:tensorflow:global_step/sec: 176.803 INFO:tensorflow:loss = 10.061047, step = 2901 (0.566 sec) INFO:tensorflow:Saving checkpoints for 3000 into train/linreg/model.ckpt. INFO:tensorflow:Loss for final step: 10.73032. For MacOS user

For Windows user

You can see this information in the PyTorch TensorBoard.

Now that you have the log events written, you can open Tensorboard. Tensorboard Keras runs on port 6006 (Jupyter runs on port 8888). You can use the Terminal for MacOs users or Anaconda prompt for Windows user.

For MacOS user # Different for you cd /Users/Guru99/tuto_TF source activate hello-tf!

The notebook is stored in the path /Users/Guru99/tuto_TF

For Windows users cd C:UsersAdminAnaconda3 activate hello-tf

The notebook is stored in the path C:UsersAdminAnaconda3

To launch Tensorboard, you can use this code

For MacOS user tensorboard --logdir=./train/linreg For Windows users tensorboard --logdir=.trainlinreg

It could also be located at the following location.

Copy and paste the URL into your favorite browser. You should see this:

Note that, we will learn how to read the graph in the tutorial dedicated to the deep learning.

If you see something like this:

It means Tensorboard cannot find the log file. Make sure you point the cd to the right path or double check if the log event has been creating. If not, re-run the code.

If you want to close TensorBoard Press CTRL+C

Hat Tip: Check your anaconda prompt for the current working directory,

The log file should be created at C:UsersAdmin


TensorBoard is a great tool to visualize your model. Besides, many metrics are displayed during the training, such as the loss, accuracy or weights.

To activate Tensorboard, you need to set the path of your file:

cd /Users/Guru99/tuto_TF

Activate Tensorflow’s environment

activate hello-tf

Launch Tensorboard

tensorboard --logdir=.+ PATH

You're reading Tensorboard Tutorial: Tensorflow Graph Visualization

Data Mining Vs Data Visualization

Introduction to Data Mining vs Data Visualization

Start Your Free Data Science Course

Hadoop, Data Science, Statistics & others

Head-to-Head Comparison Between Data Mining vs Data Visualization (Infographics)

Key Differences Between Data Mining vs Data Visualization

Following are the key differences between Data Mining vs Data Visualization:

Data Mining is the process of sorting out large data sets, extracting some data from them, and extracting patterns from the extracted data. In contrast, Data Visualization is the process of visualizing or displaying the data extracted in different graphical or visual formats such as statistical representations, pie charts, bar graphs, graphical images, etc.

Data Mining processes include sequences analysis, classifications, path analysis, clustering, and forecasting, whereas In Data Visualization contains processing, analyzing, communicating the data, etc.

In Data Mining, the system automatically displays the data during the search process through self-analysis. In contrast, Data Visualization gives a clear view of the data and will be easy for the human brain to remember and memorize large chunks of data at a glance.

Data Mining has four stages: Data Sources, Data gathering or data exploring data modeling, and deploying the data models. In contrast, In Data Visualization has seven stages: acquiring process, parsing, filtering, mining, representing, refining, and interacting.

Data Mining is a group of different activities to extract different patterns out of the large data sets in which data sets will be retrieved from different data sources. Data Visualization facilitates complex data analysis by converting numerical data into meaningful 3D pictures and other graphical images.

The different techniques available in Data Mining are Classification, Cluster, Sequence, Association, etc. Data Visualization originated from statistics and sciences, which give clear visualization at a glance, meaning a picture gives 100 words at its sight.

In Data Mining, classification is the process of identifying the rule of the data, whether it belongs to a particular class of data or not, and its’ sub-processes include building a data model and predicting the classifications. In contrast, In Data Visualization, the main application includes geographical information systems where important geographical information can be represented as visual images that represent complex information as simply as possible.

Data mining technologies include neural networks, statistical analysis, decision trees, genetic algorithms, fuzzy logic, text mining, web mining, etc. In contrast, Data Visualization has different applications, such as retail, government, medicine and healthcare, transportation, telecommunication, insurance, capital markets, and asset management.

Data Mining is an analytical process that identifies different patterns from the data sets, which can help in dealing with the flood of information and Data Visualization provides a lot of visualization techniques that have been developed over the past decades that support the exploration of large data sets.

Data Mining uncovers hidden relationships among different data sets and variables, which is a major benefit of this field. In contrast, Data Visualization defines as it is the visual object representing the data in the form of graphs and charts.

Data Mining vs Data Visualization Comparison Table

Basis For Comparison Data Mining Data Visualization

Definition Searches and produces relevant results from large data chunks. Gives a simple overview of complex data.

Preference This has different applications and is preferred for web search engines. They are preferred for data forecasting and predictions.

Area Comes under data science. Comes under the area of data science.

Platform It is operated with web software systems or applications. Supports and works better in complex data analyses and applications.

Generality New technology but underdeveloped. More useful in real-time data forecasting.

Algorithm Many algorithms exist in using data mining. No need to use any algorithms.

Integration It runs on any web-enabled platform or with any applications. Irrespective of hardware or software, it provides visual information.

Conclusion Recommended Articles

This has been a guide to Data Mining vs Data Visualization. Here we have discussed Data mining vs Data Visualization head-to-head comparison, key differences, infographics, and a comparison table. You may also look at the following articles to learn more –

Using The Microsoft Graph Api

The APIs of all those different services are connected through a tool called Microsoft Graph. It offers a single method of consuming multiple APIs, and the user only has to log in to it once to access all of the service APIs. If you wanted to access a handful of the core APIs directly, you would have to sign up for each one separately. Microsoft Graph effectively facilitates the developer’s use of the APIs.

Using the Microsoft Graph API, we have access to several related entities, such as a Microsoft 365 group, a Teams team, and documents in a SharePoint document library. For instance, the Microsoft 365 group and the SharePoint team site share the primary document library. When you retrieve information about the document library via its site object, you also discover the group’s ID. Entity information may be retrieved in a variety of methods, either directly by querying them or by using related entities to access them. For instance, both URLs will provide information on the same team; the second retrieves the underlying Microsoft 365 group and then its linked team, whereas the first uses the team object’s ID as a direct reference (related groups and teams have the same ID).

The benefits of learning Microsoft Graph API

Office 365 is the Microsoft office product that is utilized the most around the globe. The Microsoft Graph API is beneficial for commercial versions of the Microsoft Office 365 suite, or one or more of its components, like Outlook, OneNote, etc., are used by millions of people.

In any office, a user would typically spend 2 to 3 hours working on various Office suite applications like Outlook, Excel, Project, etc. Outlook creates millions of brand-new emails, events, and other items daily, while OneDrive hosts millions of files. MS Graph API is required if you wish to access the data kept in Office 365 or Azure.

Graph Explorer

A browser-based application called Graph Explorer is available to help the user learn more about Graph. Using this tool, you may use the sample tenant or sign in to your tenant to simply make calls to Graph. You can rapidly create the necessary HTTP queries and view the results directly in the browser. You may use it to quickly check that your queries are formatted correctly, to see whether the data you expect to get exists, whether the beta as mentioned above and v1.0 endpoints operate the same way, or if there are changes between the versions.

A tenant administrator must approve the application’s use inside the tenancy and frequently the rights required for carrying out the necessary tasks using the tool before using Graph Explorer. Only the administrator or all users may provide their permission to use anything.

Calling the Microsoft Graph API

You may incorporate Graph in your application in the following ways −

Create an HTTP request in your code, then immediately call Graph. Put an SDK in front of Graph before your application. The purpose of the SDKs is to simplify the already simple API access process further. The following systems and languages currently have an SDK available: Android, Angular, chúng tôi iOS, Javascript, chúng tôi Java, PHP, PowerShell, Python, and Ruby.

Additionally, UI elements with built-in Microsoft Graph integration may be found in a package called Microsoft Graph Toolkit.

Components that can be accessed by using MS Graph API

The key Microsoft Graph parts that may be accessible using the API are listed below −

Exchange server and mail (Outlook account).

Calendar for scheduling and organizing events.

The Office 365 Planner API allows you to construct tasks, add individuals who will be participating in the task, and then execute workflows across stakeholders.

You may share files and media in a variety of formats by using Microsoft One Drive storage or the Sharepoint document library.

Conversations and messages between individuals or network groups.

Access to Microsoft One Notes quickly.

Data access using Sharepoint.

If none of built-in formats suit your needs, Microsoft Graph gives you the freedom to create your data format.

Microsoft Graph API is useful for push notifications.


The objective is to get an access token from Azure AD, which you must then put in Authorization header of each HTTP request you send to Microsoft Graph. You can find out what you are permitted to perform with Microsoft Graph in the access token.

We should always adhere to the concept of least privilege when establishing the permissions in the application registration settings, which means we should only provide our agreement to fundamental rights. Therefore, the first choice always gives the fewest rights when you check the needed scopes from the Graph description.

It’s time to add some authentication-related logic to the app once we have configured the application registration following the requirements of the OAuth flow we’ve chosen to employ. For simpler processes, you may utilize libraries that provide authentication techniques, or you can authenticate using direct REST requests.


The new service-oriented architecture, which is Microsoft Graph owned by Microsoft, formerly known as Office 365 unified API, enables developers to access a sizable quantity of data from the Microsoft cloud platforms. Finally, you should be aware that 81% of Fortune 500 organizations utilize Microsoft Graph in their system, according to current statistics. This is solid evidence that Microsoft Graph is a technology with great potential for the coming years.

Java Program To Implement The Graph Data Structure

In this article, we will understand how to implement the graph data structure. we implement the graph data structure we implement graphs in Java using HashMap collection. HashMap elements are in the form of key-value pairs. We can represent the graph adjacency list in a HashMap.

Below is a demonstration of the same −

Suppose our input is −

Number of Vertices: 5 Number of edges: 5

The desired output would be −

The connections between the nodes of the Graph are: 1 - 2 1 - 3 1 - 4 2 - 4 2 - 5 3 - 4 3 - 5 4 - 5 Algorithm Step 1 - START Step 2 - Declare an object of a Graph class namely graph_object, two integers in class ‘Edge’ namely source and destination, and two integers in ‘main’ function namely vertices_count, edges_count. Step 3 - Define the values. Step 4 - Initialize values for the vertices and count. Step 5 - Create a new instance of the previously defined class. Step 6 - Initialize the instance with relevant values. Step 7 - Iterate over the instance using a ‘for’ loop, and display the output on the console. Step 8 - Display the result Step 9 - Stop Example 1

Here, we bind all the operations together under the ‘main’ function.

public class Graph {    class Edge {       int source, destination;    }    int vertices, edges;    Edge[] edge;    Graph(int vertices, int edges) {       this.vertices = vertices;       this.edges = edges;       edge = new Edge[edges];       for(int i = 0; i < edges; i++) {          edge[i] = new Edge();       }    }    public static void main(String[] args) {       int vertices_count = 5;       int edges_count = 8;       Graph graph_object = new Graph(vertices_count, edges_count);       System.out.println("A graph object is defined.");       graph_object.edge[0].source = 1;       graph_object.edge[0].destination = 2;       graph_object.edge[1].source = 1;       graph_object.edge[1].destination = 3;       graph_object.edge[2].source = 1;       graph_object.edge[2].destination = 4;       graph_object.edge[3].source = 2;       graph_object.edge[3].destination = 4;       graph_object.edge[4].source = 2;       graph_object.edge[4].destination = 5;       graph_object.edge[5].source = 3;       graph_object.edge[5].destination = 4;       graph_object.edge[6].source = 3;       graph_object.edge[6].destination = 5;       graph_object.edge[7].source = 4;       graph_object.edge[7].destination = 5;       System.out.println("The connections between the edges of the Graph are: ");       for(int i = 0; i < edges_count; i++) {          System.out.println(graph_object.edge[i].source + " - " + graph_object.edge[i].destination);       }    } } Output A graph object is defined. The connections between the edges of the Graph are: 1 - 2 1 - 3 1 - 4 2 - 4 2 - 5 3 - 4 3 - 5 4 - 5 Example 2

Here, we encapsulate the operations into functions exhibiting object-oriented programming.

public class Graph {    class Edge {       int source, destination;    }    int vertices, edges;    Edge[] edge;    Graph(int vertices, int edges) {       this.vertices = vertices;       this.edges = edges;       edge = new Edge[edges];       for(int i = 0; i < edges; i++) {          edge[i] = new Edge();       }    }    static void print(Graph graph_object,int edges_count){       System.out.println("The connections between the edges of the Graph are: ");       for(int i = 0; i < edges_count; i++) {          System.out.println(graph_object.edge[i].source + " - " + graph_object.edge[i].destination);       }    }    static void connect_edges(Graph graph_object){       graph_object.edge[0].source = 1;       graph_object.edge[0].destination = 2;       graph_object.edge[1].source = 1;       graph_object.edge[1].destination = 3;       graph_object.edge[2].source = 1;       graph_object.edge[2].destination = 4;       graph_object.edge[3].source = 2;       graph_object.edge[3].destination = 4;       graph_object.edge[4].source = 2;       graph_object.edge[4].destination = 5;       graph_object.edge[5].source = 3;       graph_object.edge[5].destination = 4;       graph_object.edge[6].source = 3;       graph_object.edge[6].destination = 5;       graph_object.edge[7].source = 4;       graph_object.edge[7].destination = 5;    }    public static void main(String[] args) {       int vertices_count = 5;       int edges_count = 8;       Graph graph_object = new Graph(vertices_count, edges_count);       System.out.println("A graph object is defined.");       connect_edges(graph_object);       print(graph_object, edges_count);    } } Output A graph object is defined. The connections between the edges of the Graph are: 1 - 2 1 - 3 1 - 4 2 - 4 2 - 5 3 - 4 3 - 5 4 - 5

Robotium Tutorial: Your First Android Framework

What is the Robotium?

Robotium is an android Testing framework to automate test cases for native and hybrid applications. Using Robotium, the developer can create strong automatic GUI testing case for Android applications. In addition, the developer could write a functional, system and acceptance test scenario, spreading many Android activities.

In this tutorial, you will learn-

Robotium testing framework

Standard Android testing framework has some limitation as below

Unable to handle multiple activities

Test execution performance is slow

Test cases are complex & hard to implement

Robotiumframework is the better choice to conduct testing on Android application

Robotium is open source framework and is considered an extension of Android test framework. Using Robotium, developer can create robust automatic GUI test cases for Android applications. Moreover, developer can write functional, system and acceptance test scenarios, spanning multiple Android activities.

Advance features of Robotium

Robotium Test Case Classes

Robotium uses set of classes ( for testing. This class supports test cases that span over multiple activities. Solo is integrated with the ActivityInstrumentationTestCase2.

Integration Robotium and ActivityInstrumentationTestCase2

Tester can write test cases without knowledge of application design (black box testing) by using Robotium test case classes. It is an outstanding feature compare to Android test case classes.

How to use Robotium

To use Robotium in your Android test project, you need follow the steps below

Using Robotium to conduct testing on Android application. To guarantee quality of your Android application, you should follow the procedure below

Design test specification

Develop test program

Execute Test Case on target device

Collect test result

Android application Testing procedure

STEP 1) Design test specification

This is the first step to test your chúng tôi this step you Define target to be test. In your Android application, there’s many targets need to be tested such as UI, Activity, components, services. Clearly defining the target in your application will help achieve wide test coverage.

Plan the test types should be conducted (Unit test, Functional test, System test).

Design test cases for maximum coverage but minimize number of test cases. The more code is tested more are chances of early bug detection.

STEP 2) Write TEST program

This section guides you how to write an Android test program using Android Junit Test and Robotium. Assume that you have already developed an Android program name HelloAndroid. This program has some functions described below:

Display a text “Hello world!” on screen.

Display a message HelloAndroid when user press “Start” button

HelloAndroid Application

System Requirements

Android platform comes with pre-integrated JUnit 3.0 framework.

In order to create Android Test Project from Eclipse, your computer must have installed:

Latest version Android Platform (currently Android 8.1)

You can download Eclipse IDE with built-in ADT (Android Developer Tools). It includes the essential Android SDK components and a version of the Eclipse IDE .

For the Robotium testing framework, you need to down Robotium library from Robotium webpage.

Create Android Test Project

Create new Android test project

Write name of your test project. As naming convention, your test project should be name “HelloAndroidTest”

Add test project name base on naming convention

Choose target application under test

Create Test Suites

Base on your test specification, you started to create test suites for your test program. You can choose various Testing framework. In this tutorial, I choose standard Android testing framework ActivityInstrumentationTestCase2. You have to add Robotium library file to a libs directory in your project folder in case you want to test with Robotium framework. (You create lib folder in your project folder).

A test case defines the fixture to run multiple tests. To define a test case, you must follow the program structure below:

Implement a subclass of TestCase.

Define instance variables that store the state of the fixture

Initialize the fixture state by overriding setUp()

Clean-up after a test by overriding tearDown().

Test program’s structure

package com.example.helloandroid.test; import com.example.helloandroid.HelloAndroid; import; import android.test.ActivityInstrumentationTestCase2; import android.widget.TextView; private HelloAndroid mActivity; private TextView mView; private String resourceString; private Solo solo; public HelloAndroidTest () { super("com.example.helloandroid",HelloAndroid.class); } @Override protected void setUp() throws Exception { mActivity = this.getActivity(); solo = new Solo(getInstrumentation(),getActivity()); mView = (TextView) mActivity.findViewById(; resourceString = mActivity.getString(com.example.helloandroid.R.string.hello_world); } @Override protected void tearDown() throws Exception { solo.finishOpenedActivities(); } public void testPrecondition() { assertNotNull(mView); } /* test Target application contains a text display "Hello World!"*/ public void testSearchText() { assertEquals(resourceString,(String) mView.getText()); } /* test HelloAndroid Activity on target application is exist*/ public void testCurrentActivity() throws Exception { solo.assertCurrentActivity("wrong activity", HelloAndroid.class); } /* test Application UI contains "Start" button */ public void testSearchButton() throws Exception { boolean found = solo.searchButton("Start"); assertTrue(found); } } Adding Test Cases

In the same package with TestSuite, we create TestCase classes

In this class, tester can obtain testing activity through getActivity() method .

You can freely create test for a testing activity by create method with name “test + original Method Name”

In test method, tester can use Android JUnit function to compare the actual value and expected value. These methods are shown in below.

Example methods of Robotium and Android Testing framework

These test suites above verified that Application GUI must display a text “Hello World!“, and contains a button name “Start“.

STEP 3) Run Test

After you finish writing your test program, run the test using the steps below

Connect Android device to your PC (or start Emulator in case you don’t have real device).

Running test program

Besides running test on IDE, you can run test on command line. In this test program, test package is chúng tôi . In Linux terminal, you can use following command to run all test in this package:

$ adb shell am instrument -w -e package com.example.helloandroid.test

STEP 4) Get test result

After test executes, you get test results .

In this test program, 4 test methods are executed. In this case, all test cases are passed.

Test result output in case all test cases passed

In case test case fails, the output is display and show you which test cases failed

Test result output in case all test cases failed

Source code examples

This articles include some Source Code examples which help you to understand the tutorial more clearly and quickly catch up the technical knowledge

HelloAndroid: Application under test .

HelloAndroidTest: Test program using Android Test framework

Power Bi Reporting Templates Expanded – Power Bi Visualization Concepts

In this tutorial, I dive into how to customize Power BI reporting templates efficiently. You may watch the full video of this tutorial at the bottom of this blog.

When you create tables inside Power BI, you can’t format or design them exactly the way you want them to be. You can only use the default order or sequential order that Power BI generates within the table, which can be determined by a value, by alphabetical order, or an ascending or descending order.

That’s why I developed Financial Reporting Templates. These are a development concept created by Enterprise DNA. With this technique, you can now create customized financial reporting templates using tables inside Power BI.

This tutorial session is taken from a much longer and more detailed Enterprise DNA member-only workshop. Here, I demonstrate key concepts around how to visualize financial information and data effectively in Power BI.

First, let’s have a look at this template that I made for financial reporting.

Financial reporting is a perfect example for this demonstration. However, there’s a lot of custom templates or custom tables that you might want to create with a variety of information, such as a summary table of your key metrics.

In the past, this was very difficult to do if you wanted to grab specific measures out of different measures and integrate them into one report and put them on top of the other.

Now in this sample template I’ve broken it down by Total Revenue, Cost of Goods Sold, and even more, which is where the true customization comes in. I’ve left a space in the table, then I have Total Gross Profit.

I’m integrating a percentage with dollar amounts as well, which is again with a customization.

Let’s get to how I created it…

To get to this point of having to customize Power BI templates, it requires a lot of re-configuring in the background, the model set up, and the technique to grab revenues and costs, and then integrate them into one.

The first thing to do is to actually create the template – a unique table that looks somewhat like this – but of course you can customize in whatever way you want. You can put different columns or have some items indented in a different way.

You also need a Normalized Column, where we’re going to run a logic through. We’re going to identify which line we’re on in our custom template based on this normalized column. 

So this is the set up of a customized template, but then you need to find a way to integrate this into your report. This is where the data model comes in.

The structure of the data model is key to integrating your customize template into your table. As you can see in my data model, the Financials Template is right at the bottom and it has no relationship to any other tables.

This is where I put my template column and use a formula to work it out at every row in the table.

So let’s have a look at the DAX formula I created to solve this.

I used the SWITCH TRUE logic in the formula, which enables me to integrate the customized template that I made into the table. It works out at each row in the table, identifying the items.

This is what the SWITCH TRUE does. For instance, if I’m on the Total Revenues row, the calculation DIVIDE Revenues by 1,000 is applied. If I’m on the Total Cost of Goods Sold row (COGS), it will show DIVIDE Revenues by 1,000 etc.

It’s the SWITCH TRUE logic that enables the allocation of results to the rows in the table.

The final piece of the puzzle for this Power BI template technique is the Row Index, which sorts out the template in the table.

If you don’t have this, it’ll get confusing and won’t sort the items in a unique way. And what I did was, I hid it so you can’t see it in the table, but it’s actually there.

If you look closely, you can see that I have the Row Index and I’m able to sort 1, 2, 3, 4, 5, and so on. That’s how I get the exact template set up as I want.

This tutorial is a breakout session from a members-only Enterprise DNA workshop around financial insights. Here I focused on the technique that I developed to customize Power BI reporting templates. The technique involves the integration of data model, DAX formula, and template creation.

I hope you able to understand how valuable this concept is and implement it in your own business. You will find it helps a lot with your financial reports and any accounting presentations you might have.



Update the detailed information about Tensorboard Tutorial: Tensorflow Graph Visualization on the website. We hope the article's content will meet your needs, and we will regularly update the information to provide you with the fastest and most accurate information. Have a great day!