Posts

ML Lab 6. Exp (sklearn decision tree)

 import pandas as pd  from sklearn.tree import DecisionTreeClassifier from sklearn.model_selection import train_test_split from sklearn import metrics col_names = ['pregnant', 'glucose', 'bp', 'skin', 'insulin', 'bmi', 'pedigree', 'age', 'label'] pima = pd.read_csv("/content/diabetes.csv", header=None, names=col_names) pima.head() #Feature Selection #split dataset in features and target variable  feature_cols = ['pregnant', 'insulin', 'bmi', 'age','glucose','bp','pedigree'] X = pima[feature_cols] y = pima.label X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=1) #Building Decision Tree Model clf = DecisionTreeClassifier() clf = clf.fit(X_train,y_train) y_pred = clf.predict(X_test) #Evaluating the Model print("Accuracy:",metrics.accuracy_score(y_test, y_pred)) #Accuracy: 0.658008658008658 #Optimizing Deci...

CN Lab Manual

CN lab manual  Click  Link

Flutter Viva

Image

Flutter Lab Program

5a1 import 'package:flutter/material.dart' ; class MyStatelessWidget extends StatelessWidget {   @override   Widget build ( BuildContext context) {     return Scaffold (       appBar : AppBar (         title : Text ( 'Stateless Widget Example' ),       ),       body : Center (         child : Text (           'Hello, Flutter!' , // In this example, MyStatelessWidget does not change after it is built. The text "Hello, Flutter!" is static.           style : TextStyle (fontSize : 24 ),         ),       ),     );   } } void main () {   runApp ( MaterialApp (     home : MyStatelessWidget (),   )); } 5a2 import 'package:flutter/material.dart' ; class MyStatefulWidget extends StatefulWidget {   @ override   _MyStatefulWidgetState createState...

HANGMAN GAME

import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Random; public class Main extends JFrame { private static final String[] WORDS = { "HELLO" , "WORLD" , "COMPUTER" , "JAVA" , "PROGRAMMING" , "ECLIPSE" }; private static final int MAX_TRIES = 6 ; private String wordToGuess ; private char [] guessedLetters ; private int triesLeft ; private JLabel wordLabel ; private JLabel triesLabel ; private JTextField letterInput ; private JButton guessButton ; public Main () { setTitle( "Hangman Game" ); setDefaultCloseOperation(JFrame. EXIT_ON_CLOSE ); setSize( 400 , 300 ); setLocationRelativeTo( null ); // Center window on screen // Initialize game state wordToGuess = selectWord(); guessedLetters = new char [ wordToGuess .length()]; triesLeft = MAX_...