Snippets Collections
using System;
using System.Collections.Generic;
using System.Xml.Linq;
class Program {
	static void Main( ) {
		XDocument employeeDoc = new XDocument(
			new XElement("Employees",
				new XElement("Employee",
					new XElement("Name", "Bob Smith"),
					new XElement("PhoneNumber", "408-555-1000")),
				new XElement("Employee",
					new XElement("Name", "Sally Jones"),
					new XElement("PhoneNumber", "415-555-2000"),
					new XElement("PhoneNumber", "415-555-2001")
				)
			)
		);//Get first child XElement named "Employees"
		XElement root = employeeDoc.Element("Employees");
		IEnumerable<XElement> employees = root.Elements();
		foreach (XElement emp in employees){
			//Get first child XElement named "Name"
			XElement empNameNode = emp.Element("Name");
			Console.WriteLine(empNameNode.Value);
			//Get all child elements named "PhoneNumber"
			IEnumerable<XElement> empPhones = emp.Elements("PhoneNumber");
			foreach (XElement phone in empPhones)
				Console.WriteLine($" { phone.Value }");
		}
	}
}
using System;
using System.Xml.Linq; // This namespace is required.
class Program
{
	static void Main( )
	{
		XDocument employeeDoc =	new XDocument(
		new XElement("Employees",
			new XElement("Employee",
				new XElement("Name", "Bob Smith"),
				new XElement("PhoneNumbers",
					new XElement("Home", "408-555-1000"))),
			new XElement("Employee",
				new XElement("Name", "Sally Jones"),
				new XElement("PhoneNumbers",
					new XElement("Home", "415-555-2000"),
					new XElement("Cell", "415-555-2001")))));
		Console.WriteLine(employeeDoc); // Displays the document
	}
}
from sklearn.model_selection import train_test_split,cross_val_predict,StratifiedKFold
from sklearn.preprocessing import StandardScaler
from sklearn.metrics import classification_report,roc_auc_score,roc_curve
from imblearn.pipeline import Pipeline as imbPipe
from imblearn.over_sampling import SMOTE
from sklearn.ensemble import VotingClassifier
from sklearn.linear_model import LogisticRegression, SGDClassifier
from sklearn.tree import DecisionTreeClassifier
from sklearn.svm import LinearSVC, SVC
from sklearn.neighbors import KNeighborsClassifier



X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42,
                                                    shuffle=True, stratify  = y)

dct = DecisionTreeClassifier(random_state=42)
sgd = SGDClassifier(random_state=42)
log = LogisticRegression(random_state=42)
svm_rbf = SVC(kernel="rbf", random_state=42)
svm_lin = LinearSVC(loss="hinge")
knn=KNeighborsClassifier()

kfold = StratifiedKFold(n_splits=4, shuffle=True, random_state=42)


Voting_pipeline = imbPipe([
    
    ("scaler", StandardScaler()),
    ("smote", SMOTE(random_state=42,n_jobs=-1)),
    ("voting", VotingClassifier(estimators=[("dct", dct),
                                            ("sgd", sgd),
                                            ("svm_rbf", svm_rbf),
                                            ("smv_lin", svm_lin),
                                            ("knn",knn),
                                            ("log", log)],voting="hard",n_jobs=-1))
])


y_pred = cross_val_predict(Voting_pipeline, X_train, y_train, cv = kfold)
print(classification_report(y_train, y_pred))

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension