Search Results
Search this site
963 results found with an empty search
- Reading a file with Node.js
Read file in asynchronously Read content of a file in a non-blocking is called asynchronous way. That is, to tell Node to read in the file, and then to get a callback when the file-reading has been finished. Callbacks Callbacks are a basic idiom in Node.js for asynchronous operations. When most people talk about callbacks, they mean the function that is passed as the last parameter to an asynchronous function. The callback is then later called with any return value or error message that the function produced. Code for write and read file const fs = require("fs"); // this is for write file fs.writeFile("read.txt","today is monday", (err) => { console.log(" file is created") }); // Read file asynchronously const fs = require("fs"); fs.readFile("read.txt","UTF-8",(err, data) =>{ console.log(data); }); Tree structure of files Run code PS C:\node js> cd .\fsAsync\ PS C:\node js\fsAsync> node index.js Output today is monday Contact us for this nodejs assignment Solutions by Codersarts Specialist who can help you mentor and guide for such nodejs assignments. If you have project or assignment files, You can send at contact@codersarts.com directly, or contact
- Create API In Nodejs
An API provides interactions between one software and another, but not users. What is REST? Application programming interfaces (APIs) are everywhere. They enable software to communicate with other pieces of software internal or external. REST is an acronym for Representational State Transfer. It is web standards architecture and HTTP Protocol. A REST Server simply provides access to resources and REST client accesses and modifies the resources using HTTP protocol. REST was first introduced by Roy Fielding in 2000. REST quite common nowadays for online services to have public-facing APIs. These enable other developers to easily integrate features like social media logins, credit card payments, and behavior tracking. REST API Operations HTTP Verbs describe the type of operation: GET: Retrieve a resource POST: Create a resource PUT: Update a resource DELETE: Delete a resource Advantages of REST APIs Rapid API is a platform for accessing web-based REST APIs. As defined previously, APIs connect services. In addition to services, APIs allow an application to access external data. With the help of REST API, one also will be able to organize complicated applications into a very easy to use resource REST API is cleaner and very easy to explore and discover. API Code Tree Structure How to write code index.js const http = require('http'); const fs = require("fs"); const server = http.createServer(function(req,res){ if(req.url =="/"){ res.end("hello from home sides"); } else if(req.url =="/userapi") { fs.readFile(`${__dirname}/userAPI/userapi.json`,"utf-8", (err,data) =>{ console.log(data); res.end(data); }); server.listen(3000, "127.0.0.1",() =>{ console.log("listening to the port no 3000"); }); userapi.js [{ "id":1, "name":"rk singh", "age":25, "email":"rk123@gamil.com", "city":"bhind" }, { "id":2, "name":"bk jha", "age":24, "email":"bk123@gamil.com", "city":"noida" }, { "id":3, "name":"aj kumar", "age":26, "email":"aj123@gamil.com", "city":"agra" }, { "id":4, "name":"bk garg", "age":28, "email":"garg123@gamil.com", "city":"bhind" } ] How to run it PS C:\node js> cd .\httpserver\ PS C:\node js\httpserver> node index.js Output Contact us for this nodejs assignment Solutions by Codersarts Specialist who can help you mentor and guide for such nodejs assignments. If you have project or assignment files, You can send at contact@codersarts.com directly or contact at
- Health Care App
Problem taken into consideration: The main problem in these times of COVID-19 is the connection of doctors with the patients remotely and having a seamless experience in the healthcare setup which can store your data as well as give some analysis for better risk analysis. You can be in need of advice at any moment thus there is a need of 24*7 availability for advice. Market Research : Market research states that there are applications which store the prescription and tests in the pdf format, but the analysis of the regularized patients tests such as blood pressure and blood sugar levels etc. is still done manually which can be harmful in the long term. The need to save this data digitally is very important. This can be done by a simple application which is having a link with the blood pressure monitoring devise as well as the sugar level monitoring devise. This is just the beginning as many people are having low level of oxygen and should keep a track of when the levels decrease or increase. This can be done in this application . Features : Login Page Inside the login page we have created login with email and password when user enter email and correct password then user is able to logged in otherwise user not able to login into this app . Home Page Inside the home page we are able to create toolbar. inside the toolbar we have created for explore and money and by clicking on to the person icon user will go to the form page and in home page we have created the 4 card like consultation, ordering, Booking ,Recording Navigation Page Inside navigation we have created the header which get the profile information like name, profile, Edit, and status, and navigation we have a features like appointment, Test Booking, Orders, Consultation, My Doctor, Medical Record, Reminders, Payment cash, Profile Page Inside the profile page we have a back button, your health profile and three tabs like Personal Inside personal we have created card view for name and profile below we have created user information Medical Life Style Hire an android developer to get quick help for all your android app development needs. with the hands-on android assignment help and android project help by Codersarts android expert. You can contact the android programming help expert any time; we will help you overcome all the issues and find the right solution. Want to get help right now? Or Want to know price quote Please send your requirement files at contact@codersarts.com. and you'll get instant reply as soon as requirement receives
- Retrieving list data from firebase inside Current User_Id
Firebase is Google's mobile application development platform that helps you build, improve, and grow your app. Here it is again in bigger letters, for impact: Firebase is Google's mobile application development platform that helps you build, improve, and grow your app Creating Models The Android framework manages the lifecycles of UI controllers, such as activities and fragments. The framework may decide to destroy or re-create a UI controller in response to certain user actions or device events that are completely out of your control. DataUser.java public class DataUser { public DataUser(String course, String date, String status, String time, String mob) { Course = course; Date = date; Status = status; Time = time; this.mob = mob; } public String getCourse() { return Course; } public void setCourse(String course) { Course = course; } public String getDate() { return Date; } public void setDate(String date) { Date = date; } public String getStatus() { return Status; } public void setStatus(String status) { Status = status; } public String getTime() { return Time; } public void setTime(String time) { Time = time; } public String getMob() { return mob; } public void setMob(String mob) { this.mob = mob; } private String Course; private String Date; private String Status; private String Time; private String mob; public DataUser() { } } Creating List_Adapter What is Adapter Adapter is a bridge between UI component and data source that helps us to fill data in UI component. It holds the data and send the data to an Adapter view then view can takes the data from the adapter view and shows the data on different views like as ListView, GridView, ListAdapter.java public class ListAdapter extends ArrayAdapter { private Activity context; List studentlist; public ListAdapter (Activity context, List studentlist) { super(context, R.layout.item_group, studentlist ); this.context=context; this.studentlist=studentlist; } @NonNull @Override public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { LayoutInflater inflater=context.getLayoutInflater(); View listviewitem=inflater.inflate( R.layout.item_group,null,true); TextView mob = listviewitem.findViewById( R.id.mob ); TextView course = listviewitem.findViewById( R.id.Course ); TextView date = listviewitem.findViewById( R.id.Date ); TextView time = listviewitem.findViewById( R.id.Time ); TextView status = listviewitem.findViewById( R.id.Status ); DataUser dataUser = studentlist.get( position ); mob.setText( dataUser.getMob() ); course.setText( dataUser.getCourse() ); date.setText( dataUser.getDate()); time.setText( dataUser.getTime() ); status.setText( dataUser.getStatus() ); return listviewitem; } } Activity for Fetching Data public class SessionBooked extends AppCompatActivity { TextView mob, Course, Date, Time, Status; ListView listView; List dataUserList; DatabaseReference databaseReference; ImageView back; ArrayList arrayList = new ArrayList<>(); ArrayAdapter arrayAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate( savedInstanceState ); setContentView( R.layout.activity_session_booked ); back=findViewById( R.id.back ); listView=findViewById( R.id.list ); dataUserList=new ArrayList<>(); back.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { finish(); } } ); String userID = FirebaseAuth.getInstance().getCurrentUser().getUid(); databaseReference=FirebaseDatabase.getInstance().getReference("LiveSession").child( userID ); databaseReference.addListenerForSingleValueEvent( new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot snapshot) { dataUserList.clear(); for (DataSnapshot ds:snapshot.getChildren()) { DataUser user=ds.getValue(DataUser.class); dataUserList.add( user ); } ListAdapter adapter=new ListAdapter( SessionBooked.this,dataUserList ); listView.setAdapter( adapter ); } @Override public void onCancelled(@NonNull DatabaseError error) { } } ); output : Hire an android developer to get quick help for all your android app development needs. with the hands-on android assignment help and android project help by Codersarts android expert. You can contact the android programming help expert any time; we will help you overcome all the issues and find the right solution. Want to get help right now? Or Want to know price quote CONTACT NOW
- Date and Time Picker Range Library
Date pickers and Time pickers provide a simple way to select a single value from a pre-determined set and we can select the range of date picker and time picker by using date and time picker library. Library we have use for date and time pickers dependencies { implementation 'com.borax12.materialdaterangepicker:library:2.0' } 1. Implement an OnDataSetListener and OnTimeSetListerner . 2. To Create date picker dialog using the supply factory Implement an OnDateSetLister In order to set on date picker we need to implement on date set Listener interfaces typically we have to implement in Activity or fragment we have to implement this like below public class Select extends AppCompatActivity implements DatePickerDialog.OnDateSetListener { } @Override public void onDateSet(DatePickerDialog view, int year, int monthOfYear, int dayOfMonth,int yearEnd, int monthOfYearEnd, int dayOfMonthEnd) { } Implement on TimeSetListener In order to receive the time set in the picker,we will need to implement the OnTimeSetListener interfaces. Typically this will be the Activity or Fragment that creates the Pickers. public class Select extends AppCompatActivity implements DatePickerDialog.OnDateSetListener, TimePickerDialog.OnTimeSetListener { } @Override public void onTimeSet(RadialPickerLayout view, int hourOfDay, int minute, int hourOfDayEnd, int minuteEnd) { Log.e("TAG---","hourOfDay: "+hourOfDay+ " minute:"+minute+ " hourOfDayEnd:"+hourOfDayEnd+ " minuteEnd:"+minuteEnd); String hourString = hourOfDay < 10 ? "0" + hourOfDay : "" + hourOfDay; String minuteString = minute < 10 ? "0" + minute : "" + minute; String hourStringend = hourOfDayEnd < 10 ? "0" + hourOfDayEnd: "" + hourOfDayEnd; String minuteStringend = minuteEnd < 10 ? "0" + minuteEnd : "" + minuteEnd; String time = "" + hourString + ":" + minuteString; String timeEnd = "" + hourStringend + ":" + minuteStringend; if(hourOfDayEnd>hourOfDay) { time1.setText( "Start Time " + time + " End Time " + timeEnd ); } else if(hourStringend.isEmpty()) { Toast.makeText( Select.this, "Enter End Time", Toast.LENGTH_SHORT ).show(); } else { Toast.makeText( Select.this, "Invalid End Time", Toast.LENGTH_SHORT).show();
- Expandable ListView Android
Welcome to Android ExpandableListView Example Tutorial. In this tutorial we’ll implement an ExpandableListView which is used to group list data by categories. It’s sort of menu and submenus in a Android ListView. output : Android ExpandableListView is a view that shows items in a vertically scrolling two-level list. It differs from a ListView by allowing two levels which are groups that can be easily expanded and collapsed by touching to view and their respective children items. ExpandableListViewAdapter in android loads the data into the items associated with this view. MainActivity ExpandableListView expa; ArrayList list=newArrayList<>(); HashMap> listChild=newHashMap<>(); expa = findViewById( R.id.exlist ); list.add( "Machine Learning" ); list.add( "Android" ); list.add( "Java" ); list.add( "C++" ); list.add( "Programming" ); list.add( "R language " ); ArrayList arraylist = new ArrayList<>(); for(int i=0;i<=4;i++) { arraylist.add( "10:20 AM"+i ); } Adapter.java public class MainAdapter extends BaseExpandableListAdapter { List list;HashMap> listChild ; public Main Adapter( Listlist, HashMap> listChild) { this.list=list; this.listChild=listChild; } @OverridepublicintgetGroupCount() {return list.size(); } @Override public intgetChildrenCount(intgroupPosition) { return listChild.get( list.get( groupPosition ) ).size(); } @Override public Objectget Group(intgroupPosition) { return list.get( groupPosition ); } @Override public Object getChild(intgroupPosition, intchildPosition) { return listChild.get( list.get( groupPosition ) ).get( childPosition ); } @Override public longgetGroupId(intgroupPosition) { return groupPosition; } @Override public longgetChildId(intgroupPosition, intchildPosition) { return childPosition; } @Override public boolean hasStableIds() { return false; } @Override public ViewgetGroupView(final int groupPosition, boolean isExpanded, View convertView, final ViewGroup parent) {// initialize value convertView=LayoutInflater.from( parent.getContext() ).inflate( android.R.layout.simple_expandable_list_item_1,parent,false ); TextView textView=convertView.findViewById( android.R.id.text1 ); //initialise stringString sGroup =String.valueOf( getGroup( groupPosition ) ); //set Text view textView.setText( sGroup ); textView.setTypeface( null, Typeface.BOLD ); textView.setTextColor( Color.BLUE );return convertView; } @Override public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, finalViewGroup parent) {//initialise view convertView=LayoutInflater.from( parent.getContext()).inflate(android.R.layout.simple_selectable_list_item,parent,false); TextView textView=convertView.findViewById( android.R.id.text1 ); finalString schild=String.valueOf( getChild( groupPosition,childPosition ) ); // set on text view textView.setText( schild ); textView.setOnClickListener( newView.OnClickListener() { @Override publicvoidonClick(View) { Toast.makeText( parent.getContext(), schild, Toast.LENGTH_SHORT ).show(); } } ); return convertView; } @Override public boolean isChildSelectable(intgroupPosition, intchildPosition) { return true; } } Contact us for andriod assignment Solutions by Codersarts Specialist who can help you mentor and guide for such assignments. CONTACT US TODAY
- Bluetooth Low Energy
You probably heard Bluetooth before maybe you using in your car while listening to your favorite music or while talking on the phone through a wireless headset and recently you mat come across the term Bluetooth low Energy so what is BlE. BLE low power Wireless Technology Connecting Device Ble introduces in 2010 as a part of foo tooth 4.0 it is not an upgrade of original Bluetooth but rather its new technology that utilizes the Bluetooth brand but forces more on the internet of things or IoT applications where a small amount of data are transferred at a lower speed. Ble operates in 2.4 GHz ASM band spectrum that used by Bluetooth, Applications Of Ble's M2M/IoT : fitness devices indoor location Technology Medical Devices Personal Health Devices Blood pressure monitors Fitbit-like devices Industrial monitoring sensors Geography-based, targeted promotions (iBeacon) Public transportation apps Key terms and concepts Generic Attribute Profile (GATT) The GATT profile is a general specification for sending and receiving short pieces of data known as "attributes" over a BLE link. All current Low Energy application profiles are based on GATT. Attribute Protocol (ATT) GATT is built on top of the Attribute Protocol (ATT). This is also referred to as GATT/ATT. ATT is optimized to run on BLE devices. To this end, it uses as few bytes as possible. Each attribute is uniquely identified by a Universally Unique Identifier (UUID), which is a standardized 128-bit format for a string ID used to uniquely identify information. The attributes transported by ATT are formatted as characteristics and services. Characteristic—A characteristic contains a single value and 0-n descriptors that describe the characteristic's value. A characteristic can be thought of as a type, analogous to a class. Descriptor—Descriptors are defined attributes that describe a characteristic value. For example, a descriptor might specify a human-readable description, an acceptable range for a characteristic's value, or a unit of measure that is specific to a characteristic's value. Service—A service is a collection of characteristics. For example, you could have a service called "Heart Rate Monitor" that includes characteristics such as "heart rate measurement. Ble Permissions Benefits Lower Power Consumption: Low power consumption compare to other technologies Free Cost Access Official specification documents lower module and chipset cost Low Power Radio off Longer short bursts of data Low Transfer Speed Hire an android developer to get quick help for all your android app development needs. with the hands-on android assignment help and android project help by Codersarts android expert. You can contact the android programming help expert any time; we will help you overcome all the issues and find the right solution. Want to get help right now? Or Want to know price quote Please send your requirement files at contact@codersarts.com. and you'll get instant reply as soon as requirement receives
- Kalman tracking for multiplepoints - Sample Assignment
Problem Statement: In this assignment you have to implement Kalman tracking for multiple points, simultaneously, through a video. The code will take a video (either as one video file or as individual frames) and output the tracks of the points through the video. Use Harris points in the first frame as the set of points to be tracked. Limit the number of points to be the 50 strongest point responses. Many of these points might not fall on moving objects, which is fine. The tracks generated for stationary points should be of zero length. Your tracking should be agnostic to which features are from the moving objects and which are not. It should be able to track objects that stop and restart. Study the effect on the quality of the tracks with (a) state representation, i.e., location only, location + velocity, and location + velocity + acceleration, (b) change in state model covariance, and (c) change in measurement covariance. Investigate at least 5 different variations for (b) and (c) As output, overlay the entire tracks on the last frame of the video and show them as one image per video in your report. Show results on at least 5 videos of at least 200 frames, each. You can link to any video visualizations that you might have as well. Along with the track include visualization of the uncertainties involved using error ellipses. You may use any video data available at https://motchallenge.net/ for your assignment. Submission Requirements: Please upload a ZIP file containing the following files: 1. All your code files, including any helper files/dependencies. 2. A README file detailing how to run your code along with any compilation instructions. 3. A 2-Page technical report containing the following sections: a. A short description of the algorithm b. A description of any code/algorithms that were used/re-used by you for your implementation. c. A few examples of results from your implementations, comparison with the original implementation (if needed). d. A general discussion of lessons learned based on your experiments with the algorithm. E.g. What did you struggle with, issues faced while implementing the code, scopes for and/or proposed improvements, etc. Grading: Each assignment will be graded out of 100: Code (out of 30) quality of coding, readability, understandability (comments, variable names, etc.) Report (out of 40), point 3a, 3b, 3c, and 3d above Demo and Results (out of 30): Compilations, execution, correctness of results on test cases. Solutions to your programming assignments have to be self-sufficient and not dependent on other computer vision codes, such as OpenCV or Matlab vision package. You may use packages for display graphics or mathematics packages, such as for linear algebra (NumPy, for example, Matlab (but not computer vision module)) or graphs or optimization. You can use any code distributed in the class. Codersarts is a top rated website for students which is looking for online Programming Assignment Help, Homework help, Coursework Help in C,C++,Java,Python,Database,Data structure, Algorithms ,Final year project,Android,Web,C sharp, ASP NET to students at all levels whether it is school, college and university level Coursework Help or Real time project. Hire us and Get your projects done by computer science expert.
- Implement Decision Tree Classification In Java: Java Sample
Introduction This year, we are going to implement, through a succession of assignments, a simplified version of a useful machine learning technique, called decision tree classification. If you are not familiar with decision trees and are curious to know what they are, you may wish to have a quick look at the following Wikipedia page: https://en.wikipedia. org/wiki/Decision_tree_learning. For Assignment 1, however, you are not going to do anything that is specific to decision trees; you can complete Assignment 1 without any knowledge of decision trees! We will get to decision trees only in Assignments 2 and 3. If you find the above Wikipedia page overwhelming, fear not! As we go along, we will provide you with simple and accessible material to read on decision tree classification. Ultimately, the version of decision tree classifica- tion that you implement, despite still being extremely useful, has many of the complexities of the more advanced implementations removed (for example, handling “unknown” values in your training data). As far as the current assignment – Assignment 1 – is concerned, we have modest goals: we would like to read an input file, which will (in future assignments) constitute the training data for our learning algorithm, and perform some basic tasks that are prerequisites to virtually any type of machine learning. Specifically, you will be implementing the following tasks in Assignment 1: Task 1. Parsing comma-separated values (CSV) from a given data file and populating appropriate data struc- tures in memory Task 2. Extracting certain summary data (metadata) about the characteristics of the input data; this metadata will come handy for the construction of decision trees in future assignments. These two tasks are best illustrated with a simple example. Suppose we have a CSV file named weather.csv with the content shown in Figure 1. 1: The data is simply a table. The first (non-empty) row in the file provides the names of the table columns in a comma-separated format. Each column represents an attribute (also called a feature). The remaining (non-empty) rows are the datapoints. In our example, each datapoint is a historical observation about weather conditions (in terms of outlook, tem- perature in fahrenheit, humidity and wind), and whether it has been possible to “play” a certain tournament (for example, cricket) outside. What a machine learning algorithm can do here is to “learn from examples” and help decide / predict whether one can play a tournament on a given day according to the weather conditions on that day. Now, going backing to Task 1 and Task 2, below is what each of these tasks would do with the data in Figure 1. Task 1: will parse the input data and build the conceptual memory representation shown in Figure 2. More precisely, we get (1) an instance variable, attributeNames (discussed later), instantiated with a String array of length 5 and containing the column names, and (2) an instance variable, matrix (also discussed later), instantiated with a two-dimensional String array (of size 14×5) and populated with the datapoints in the file. Task 2: will identify the unique values observed in each column. If all the values in a column happen to be numeric, then the column is found to be of numeric type. Otherwise, the column will be of nominal type, meaning that the values in the column are to be treated as labels without any quantitative value associated with them. For our example file, the column types and the set of unique values for each column would be as shown in Figure 3. Note that, for this assignment, you do not need to sort the numeric value sets in either ascending or descending order. This becomes necessary only in the future assignments. Important Considerations (Read Carefully!) While the assignment is conceptually simple, there are some important consideration that you need to carefully pay attention to in your implementation. Determining the size of the arrays to instantiate: You will be storing the attribute names and datapoints using two instance variables that are respectively declared as follows: private String[] attributeNames; private String[][] matrix; One problem that you have to deal with is how to instantiate these variables. To do so, you need to know the number of attributes (columns) and the number of datapoints. You can know the former number only after counting the attributes names on the first (non-empty) line of the file. As for the latter (number of datapoints), you can only know this once you have traversed the entire file. Later on in the course, we will see “expandible” data structure like linked lists, which do not have a fixed size, allowing elements to be added to them as you go along. For this assignment, you are expressly forbidden from using lists or similar data structures with non-fixed sizes. Instead, you are expected to work with fixed-size arrays. For this assignment, the easiest way to instantiate the arrays is through a two-pass strategy. This means that you will go over the input file twice. In the first pass, you merely count the number of columns and datapoints. With these numbers known, you can instantiate attributeNames and matrix. Then, in a second pass, you can populate (the now-instantiated) attributeNames and matrix. Note that, as illustrated in Figure 2, you are expected to instantiate matrix as a row × column array, as oppposed to a column × row array. While this latter strategy is correct too, you are asked to use the former (that is, row × column) as a convention throughout this assignment. Removing blank spaces and empty lines: The blank spaces surrounding attribute names and values should be discarded. For example, consider the input file in Figure 4. This file is the same as the one in Figure 1, only with some surrounding spaces added. These surrounding spaces need to be trimmed and ignored. The same goes with empty lines. Empty lines can be treated as non-existent Supporting commas in attribute names and values: Since commas are used as separators (delimiters), it is important to provide a way to support commas within attribute names and attribute values. To do so, you will need to implement an escape sequence mechanism. You will do so using single quotes (’). More precisely, commas are to be treated as regular characters if a text segment is embraced with single quotes. To illustrate, consider the example input in Figure 5. The metadata information derived from this input is shown in Figure 6. While not explicitly shown by Figure 6, the values to store in attributeNames and matrix are obviously affected when escape sequences with single quotes are present in the input file. Missing attribute values: There may be situations where not all attribute values are known (for example, due to incomplete data collection). In such cases, the attribute values in question may be left empty. Your implementation needs to be able empty (missing) attribute values. You can choose to represent missing values with a special value, for example ‘MISSING’. Alternatively, you can choose to represent missing values with an empty string (‘’). To illustrate, consider the input file in Figure 7, where some values are missing. The metadata derived from this input file is shown in Figure 8. Here, we have chosen to represent missing values with the empty string. For this assignment, you should designate any column that has missing values as nominal. For example, in Figure 7, some of the values for the humidity attribute are missing. This has resulted in humidity to no longer be a numeric attribute but rather a nominal one, as shown in Figure 8. Efficiency in identifying unique attribute values: You need to be prepared for the possibility that your input file would be large. One particular place you need to be careful with is when you are determining the unique set of values that a given attribute can assume. Your implementation should be efficient (hint: should not do futile search) in order to avoid a quadratic runtime. Implementation We are now ready to program our solution. We will only need two classes for this. For the assignment, you need to follow the patterns that we provide. You cannot change any of the signatures of the methods (that is you cannot modify the methods at all). You cannot add new public methods or variables. You can, however, add new private methods to improve the readability or the organization of your code. DataSet There are a number of methods in DataSet that you need to either complete or implement from scratch. Guidance is provided in the template code in the form of comments. The locations where you need to write code have been clearly indicated with an inline comment that reads as follows: // WRITE YOUR CODE HERE! The easiest way to navigate the template code is to start from the main method of the DataSet class, shown in Figure 9. Intuitively, this method works as follows: First, it reads from the standard input the name of the CSV file to process. Next, it creates an instance of DataSet; the constructor of DataSet will process the input file and populate attributeNames and matrix (explained earlier). Finally, the main method prints to the standard output the metadata of the instance of the DataSet that was just created. Doing so requires calling the metadataToString() instance method. To better illustrate metadataToString(), Figure 10 shows the return value of metadataToString() by our reference implementation for the input file of Figure 1 (the instructors’ reference implementation will be released to you after the assignment due date). Please note that there are a couple of technicalities which you will learn about only later in the course. One is how to process files. The other (and much more important technicality, for that matter) is the notion of exceptions in Java. For this assignment, the template code for file processing is provided wherever it is needed. As for exceptions, you do not have to deal with them in this assignment, but you will see that some methods in the code are declared as throwing exceptions. You can ignore these exception declarations for now Util The Util class is provided in order to facilitate the implementation of the metadataToString() method, which you will be implementing in the DataSet class (see the template code). The Util class provides four static methods: public static boolean is numeric(String str): Checks if str represents a numeric value isArrayNumeric(String[] array): Checks an array of strings, array, and returns true if and only if the array is non-empty and all its elements represent numeric values Public static String nominalArrayToString(String[] array): Produces a string representation of an array of nominals. Note that all nominal labels are embraced with single quotes. public static String numericArrayToString(String[] array): Produces a string representation of an array of numerics. Unlike nominals, numeric values are not embraced with single quotes in the representation. JUnit Tests We are providing a set of JUnit tests for the class DataSet. These tests should help make sure that your implementation is correct. They can further help clarify the expected behavior of this class if need be. Please note that the DataSetTest class assumes that the following CSV files are located in the current directly: credit-info-with-commas.csv, weather-nominal.csv, credit-info.csv, weather-numeric.csv, large.csv, weather-with-spaces.csv, and missing-values.csv. You can find all these CSV files in the datasets directory of the template zip file you have been provided with Academic Integrity This part of the assignment is meant to raise awareness concerning plagiarism and academic integrity. Please read the following documents. https://www.uottawa.ca/administration-and-governance/academic-regulation-14-other-important-information https://www.uottawa.ca/vice-president-academic/academic-integrity Cases of plagiarism will be dealt with according to the university regulations. By submitting this assignment, you acknowledge: I have read the academic regulations regarding academic fraud. I understand the consequences of plagiarism. With the exception of the source code provided by the instructors for this course, all the source code is mine. I did not collaborate with any other person, with the exception of my partner in the case of teamwork. If you did collaborate with others or obtained source code from the Web, then please list the names of your collaborators or the source of the information, as well as the nature of the collaboration. Put this information in the submitted README.txt file. Marks will be deducted proportionally to the level of help provided (from 0 to 100%) Rules and regulation Follow all the directives available on the assignment directives web page. Submit your assignment through the on-line submission system virtual campus. You must preferably do the assignment in teams of two, but you can also do the assignment individually. You must use the provided template classes below. If you do not follow the instructions, your program will make the automated tests fail and consequently your assignment will not be graded. We will be using an automated tool to compare all the assignments against each other (this includes both, the French and English sections). Submissions that are flagged by this tool will receive the grade of 0. It is your responsibility to make sure that BrightSpace has received your assignment. Late submissions will not be graded Codersarts is a top rated website for online Programming Assignment Help, Homework help, Coursework Help, coding help in Angular. Get your project or assignment completed by Angular expert and experienced developers.
- Beginning Flutter - Intermediate - Using Common Widgets
In this Blog We have to gonna take a look how basic widgets such as Scaffold App Bar Safe Area Container Text Rich Text Column Row Different types of Buttons We learn how to use the most common widget we call them basic building blogs for creating beautiful user interfaces in user experiences. Scaffold widget the scaffold widget implements the basic material design visual layout allowing us to easily add various widgets such the app bar bottom app bar a floating action button a drawer snack bar button. scaffold( appBar : AppBar( leading : Icon(Icons.menu), title : Text("Gratitude"), actions : [ IconButton( icon : Icon(Icon.check), onPressed : () => Navigation.pop( context, _SelectedGratiude , ), ), ], ), body : MoodBody(), drawer : MoodDrawer(), bottumNavigationBar : MoodNavBar(), floatingActionButton: FloatingActionButton( child : Icon(Icon.add), ), ); AppBar The AppBar widget usually contains a standard title Toolbar leading and Action Properties allow with button as well as many customization options the title property typically implemented with a text widget we can customize it with order widget such as a drop down widget the leading property is display before the title property usually this is icon button the action property is displayed right of the title property. Codersarts has become one of the most trusted platforms to help students,professional developers who are looking for coding help, and wanna hire programming developers. Our programmers and developers are well-known with intuitive tools,IDEs, and visual design. Codersarts allows anyone to get coding solutions easily and build a professional connection to make the world the most affordable place to expand and share work experiences.
- Firebase Backend as a Service BaaS
Firebase is a Backend-as-a-Service — BaaS — that started as a YC11 startup and grew up into a next-generation app-development platform on Google Cloud Platform. Firebase Features Firebase has several features that make this platform essential. These features include unlimited reporting, cloud messaging, authentication and hosting, etc. App Development Mode With Firebase, we can focus our time and attention on developing the best possible applications for our business. The operation and internal functions are very solid. They have taken care of the Firebase Interface. We can spend more time in developing high-quality apps that users want to use. cloud Messaging Authentication Hosting Remote Configuration Dynamic Link Crash Reporting Real Time Database Storage Cloud Messaging Firebase allows us to deliver and receive messages in a more reliable way across platforms. Authentication Firebase has little friction with acclaimed authentication. Hosting Firebase delivers web content faster. Remote Configuration It allows us to customize our app on the go. Dynamic Link Dynamic Links are smart URLs which dynamically change behavior for providing the best experience across different platforms. These links allow app users to take directly to the content of their interest after installing the app - no matter whether they are completely new or lifetime customers. Crash Reporting It keeps our app stable. Real Time Database It can store and sync app data in real-time. Storage We can easily store the file in the database. Growth And User Engagement One of the most important aspects of application development is being able to develop and engage with users over time. Firebase has a lot of built-in features, which ensures that it is exactly what we do. With the platform leading to commercial apps, it is really at the center of what makes Firebase so great. App Indexing With app indexing, we can work on aspects like re-engaging with our app, especially by surfing the in-app content within Google search results. It will also help in ranking our application in Google search results. Invites It is a perfect tool for referrals and sharing. Get the help of our users to develop our app easily via email or SMS, allowing their existing users to share our app or in-app content. If we use this feature in combination with promotions, then we can also work towards acquiring new customers and retaining our existing customers. Notifications We can manage information campaigns very easily, including the ability to set and schedule messages to engage users at the right time of day. These notifications are completely free. These are unlimited for both iOS and Android. There is only one dashboard to worry about, and if we integrate with Firebase Analytics, we can use various user segmentation features. Codersarts is a top rated website for online Programming Assignment Help, Homework help, Coursework Help, coding help. Get your project or assignment completed by expert and experienced developers. CONTACT US NOW
- Different techniques for Text Vectorization.
In this blog, we will be discussing various techniques to vectorize the texts in NLP. Before we move forward let us briefly discuss what is NLP. NLP (Natural language processing) is a branch of artificial intelligence that helps machines to understand, interpret and manipulate human language. Since the beginning of the brief history of Natural Language Processing (NLP), there has been the need to transform the text into something a machine can understand. We all know that computers don’t understand English or any language as it is. They only understand binary language that is only 1 and 0 (Bits). Thus, arises the need to transform the text into a meaningful vector (or array) of numbers (or simply to encode the text), so that the computer can better understand the text and hence the language. Machine learning algorithms most often take numeric feature vectors as input. Thus, when working with text documents, we need a way to convert each document into a numeric vector. This process is known as text vectorization. In much simpler words, the process of converting words into numbers is called Vectorization. Before actually diving into the whole process of vectorization. Let us first set a corpus to work with, we will be choosing a very common example, you might have seen it on various websites. corpus = [ 'the quick brown fox jumped over the brown dog.', 'the quick brown fox.', 'the brown brown dog.', 'the fox ate the dog.' ] Our corpus consists of four sentences, these four sentences can be thought of as four different documents. Now that we have our corpus we will get on with vectorization. Vectorization is better understood with examples. The following are the different ways of text vectorization: CountVectorizer It is a great tool provided by the sci-kit-learn library in Python. It is used to transform a given text into a vector on the basis of the frequency (count) of each word that occurs in the entire text. Documentation: https://scikit-learn.org/stable/modules/generated/sklearn.feature_extraction.text.CountVectorizer.html CountVectorizer creates a matrix in which each unique word is represented by a column of the matrix, and each text sample from the document is a row in the matrix. The value of each cell is nothing but the count of the word in that particular text sample as shown below. For the corpus above, our matrix would be something like as follows. The first sentence or the document would be transformed into a vector [02111112]. In a similar manner, each document can be represented by a vector. Let us try to code it and see the result for ourselves. The CountVectorizer provides a simple way to both tokenize a collection of text documents and build a vocabulary of known words, but also to encode new documents using that vocabulary. You can use it as follows: 1. Create an instance of the CountVectorizer class. 2. Call the fit() function in order to learn a vocabulary from one or more documents. 3. Call the transform() function on one or more documents as needed to encode each as a vector. An encoded vector is returned with a length of the entire vocabulary and an integer count for the number of times each word appeared in the document. Code snippet: from sklearn.feature_extraction.text import CountVectorizer # create an object of CountVectorizer class. vectorizer = CountVectorizer() # tokenize and build vocabulary vectorizer.fit(corpus) # encode vector = vectorizer.transform(corpus) # summarize encoded vector print('Vocabulary :',vectorizer.vocabulary_) print('\nShape of the vector: ',vector.shape) print('\ntype of vector: ',type(vector)) print('\nBelow are the sentences in vector form:') print(vector.toarray()) Output: We can see that we got the same result as above. Now you must be getting what it means to vectorize text. Once the text is vectorized it is ready to be fed to machine learning models as an input. Let us try out some more methods to perform vectorization. TfIdfVectorizer It is another one of the great tools provided by the scikit-learn library. It is a very common algorithm to transform the text into a meaningful representation of numbers which is used to fit machine algorithms for prediction. Documentation: https://scikit-learn.org/stable/modules/generated/sklearn.feature_extraction.text.TfidfVectorizer.html?highlight=tfidf%20vectorizer#sklearn.feature_extraction.text.TfidfVectorizer TF-IDF is a product of two terms: TF (Term Frequency) — It is defined as the number of times a word appears in the given sentence. IDF (Inverse Document Frequency) — It is defined as the natural log of a number of the total documents divided by the documents in which the word appears. For example, we will calculate the Tf-Idf values for the first sentence in the corpus. Step 1: Create a vocabulary of unique words. In our case the vocabulary would be: ['ate', 'brown', 'dog', 'fox', 'jumped', 'over',' quick', 'the']. Step2: Create an array of zeroes for each sentence in the corpus, with a size equal to the number of unique words in the corpus. For e.g. the array for the first sentence would be [00000000]. In this way, we will get 4 arrays of length 8. Step3: We calculate Tf-Idf for each word in each sentence. We select the first sentence to illustrate this step. We know that: Total documents/sentences (N): 4 Documents in which the word appears (n): 3 Number of times the word appears in the first sentence: 1 Number of words in the first sentence: 9 Term Frequency (TF) = 1 **If smooth_idf=True (the default), the constant “1” is added to the numerator and denominator of the idf as if an extra document was seen containing every term in the collection exactly once, which prevents zero divisions: idf(t) = log [ (1 + n) / (1 + df(t)) ] + 1.** Inverse Document Frequency(IDF) = ln((1+N)/(1+n))+1 = ln(5/4)+1 = 0.22314355131 + 1 = 1.22314355131 TF-IDF value = 1 * 1.22314355131 = 1.22314355131 Same way Tf-Idf is calculated for each word in the vocabulary and then the values obtained are normalized. In TfIdfVectorizer the parameter 'norm' has a default value of 'l2'. In this case, the sum of squares of vector elements is 1. If the norm is set as 'l1', then sum of absolute values of vector elements is 1. We can also set value of norm parameter to be 'False' and not opt for any kind of normalization at all. The Tf-Idf values for all the words in the first sentence is: 'ate': 1.916290731874155, 'brown': 2.44628710263, 'dog': 1.2231435513142097, 'fox': 1.2231435513142097, 'jumped': 1.916290731874155, 'over': 1.916290731874155, 'quick': 1.5108256237659907, 'the': 2.0 After applying the default norm in TfIdfVectorizer i.e. the 'l2' norm. We get the following values: 'ate': 0.0, 'brown': 0.51454148, 'dog': 0.25727074, 'fox': 0.25727074, 'jumped': 0.40306433, 'over': 0.40306433, 'quick': 0.31778055, 'the': 0.42067138 Thus the vector for the first sentence would be: [0. 0.51454148 0.25727074 0.25727074 0.40306433 0.40306433 0.31778055 0.42067138] Let us try to code it and see the result for ourselves. The implementation is similar to CountVectorizer, but in this case we make an object of the TfIdfVectorizer class instead of the CountVectorizer. Code snippet: from sklearn.feature_extraction.text import TfidfVectorizer # create an object of TfidfVectorizer class. vectorizer = TfidfVectorizer() # tokenize and build vocabulary vectorizer.fit(corpus) # encode vector = vectorizer.transform(corpus) # summarize encoded vector print(vectorizer.vocabulary_) print(vectorizer.idf_) print(vector.shape) print(vector.toarray()) Output: The TfIdfVectorizer will tokenize documents, learn the vocabulary and inverse document frequency weightings, and allow you to encode new documents. Alternately, if you already have a learned CountVectorizer, you can use it with a TfidfTransformer to just calculate the inverse document frequencies and start encoding documents. HashingVectorizer This is also a method provided by scikit-learn. It also converts a collection of text documents to a matrix of token occurrences just like CountVectorizer but the process is a little different. Documentation: https://scikit-learn.org/stable/modules/generated/sklearn.feature_extraction.text.HashingVectorizer.html The vocabulary build while working with CountVectorizer can become very huge when the size of the documents increase. This, in turn, will require large vectors for encoding documents and impose large requirements on memory and slow down algorithms and also it would take up a lot of memory. In order to get around this HashingVectorizer is used. In HashingVectorizer we use a one way hash of words to convert them to integers. The best part is that, in this case no vocabulary is required and you can choose an arbitrary-long fixed length of the vector. A downside is that the hash is a one-way function so there is no way to convert the encoding back to a word (which may not matter for many supervised learning tasks). Here the vectorizer does not require a call to fit on the training data documents. Instead, after creating the object, it can be used directly to start encoding documents. We can set the length of vector by assigning the value to the parameter 'n_features'. In this example we will create a vector of length 10. It is acceptable since our documents are very small. In case of large documents the value of n_features should be such that it can avoid hash-collisions. code snippet: from sklearn.feature_extraction.text import HashingVectorizer # create an object of HashinVectorizer class. vectorizer = HashingVectorizer(n_features=10) # encode directly without fitting vector = vectorizer.transform(corpus) # summarize encoded vector print('\nShape of vector: ',vector.shape) print('\nBelow are the sentences in vector form:') print(vector.toarray()) Output: The values of the encoded document correspond to normalized word counts by default in the range of -1 to 1, but could be made simple integer counts by changing the default configuration. The above three methods were Bag of words approach provided by scikit learn. The next approaches would be that of neural network model. Word2Vec Word2vec is a combination of models used to represent distributed representations of words in a corpus. It is a set of neural network models that aim to represent words in the vector space. These models are highly efficient and well performing in understanding the context and relation between words. Similar words are placed close together in the vector space while dissimilar words are placed wide apart. Documentation: https://radimrehurek.com/gensim/models/word2vec.html There are two models in this class: CBOW (Continuous Bag of Words): The neural network takes a look at the surrounding words (say 3 to the left and 3 to the right or whatever may be the window size) and predicts the word that comes in between. code snippet: from gensim.models import word2vec for i, sentence in enumerate(corpus): tokenized= [] for word in sentence.split(' '): word=word.split('.')[0] word = word.lower() tokenized.append(word) corpus[i] = tokenized model1 = word2vec.Word2Vec(corpus, workers = 1, size = 2, min_count = 1, window = 3, sg = 0) vocabulary1 = model1.wv.vocab print(vocabulary1) v1 = model1.wv['fox'] print('\nShape of vector: ',v1.shape) print('\nBelow is the vector representation of the word \'fox\':') print(v1) Output: 2. Skip-grams: The neural network takes in a word and then tries to predict the surrounding words (context). The idea of skip gram model is to choose a target word and then predict the words in it’s context to some window size. It does this by maximizing the probability distribution i.e. probability of the word appearing in the context (within the specified window) given the target word. code snippet: model2 = word2vec.Word2Vec(corpus, workers = 1, size = 3 ,min_count = 1, window = 3, sg = 1) vocabulary2 = model2.wv.vocab print(vocabulary2) v2 = model2.wv['fox'] print('\nShape of vector: ',v2.shape) print('\nBelow is the vector representation of the word \'fox\':') print(v2) Output: Notice in this case I have set the size of the vector to be 3 thus the vector in this case have three elements in it. ElMo ElMo stands for Embeddings from Language Models. ElMo is a deep contextualized word representation that models both (1) complex characteristics of word use (e.g., syntax and semantics), and (2) how these uses vary across linguistic contexts (i.e., to model polysemy). These word vectors are learned functions of the internal states of a deep bidirectional language model (biLM), which is pre-trained on a large text corpus. They can be easily added to existing models and significantly improve the state of the art across a broad range of challenging NLP problems, including question answering, textual entailment and sentiment analysis. Unlike traditional word embeddings such as word2vec, the ElMo vector assigned to a token or word is actually a function of the entire sentence containing that word. Therefore, the same word can have different word vectors under different contexts. code snippet: import tensorflow_hub as hub import tensorflow as tf elmo = hub.load("https://tfhub.dev/google/elmo/2") # Extract ELMo features embeddings = elmo.signatures["default"](tf.constant(corpus) )["elmo"] print('\nShape of vector: ',embeddings.shape) print('\nBelow is the vector representation of the sentences:') print(embeddings) Output: The output is a 3 dimensional tensor of shape (4, 9, 1024). The first dimension of this tensor represents the number of training samples. This is 4 in our case The second dimension represents the maximum length of the longest string in the input list of strings. Which is 9 in our case. The third dimension is equal to the length of the ElMo vector Hence, every word in the input sentence has an ElMo vector of size 1024. These were few text vectorization techniques. I hope you understand the concept better now. If you need implementation for any of the topics mentioned above or assignment help on any of its variants, feel free contact us











