This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Rejecting, or not rejecting Hypothesis in Chi-Square test | |
if abs(stat) >= critical_stat: | |
print("Reject Hypothesis H0, There is relationship, Dependent") | |
else | |
print("Cannot Reject Hypothesis H0, There is no relationship, independent") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Fiding Chi-Square using Scipy | |
from scipy.stats import chi2_contingency | |
from scipy.stats import chi2 | |
stat, _, dof, expected_table = chi2_contingency(con_table) | |
alpha = 0.05 | |
#finding critical stat in Chi-Square table | |
critical_stat = chi2.ppf(1-alpha, dof) #it takes probability, instead of alpha |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#How to get contingency table | |
import pandas as pd | |
#Read the csv data file | |
data = pd.read_csv('train.csv') | |
#Getting 'Embarked' feature values without null value | |
embarked = data[pd.notnull(data['Embarked'])]['Embarked'] | |
#Getting 'Survival' feature values correponding to 'Embarked' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//A code for article published at calloftechies.com | |
private fun getNames() : ArrayList<String?>{ | |
var files = myDirectory.listFiles() | |
val fileNames : ArrayList<String?> = ArrayList() | |
for(file in files){ | |
fileNames.add(file.getName()) | |
} | |
return fileNames | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Put this code in the class which extens State class | |
static const platform = const MethodChannel('samples.flutter.dev/filesChannel'); //used to connect with Java/Kotlin | |
List<dynamic> fileNames = <dynamic>[]; | |
Future<void> _invokeNativeFun(int flag) async { | |
String s; | |
try { | |
if(flag == 0) | |
fileNames = await platform.invokeMethod('getNames'); //getNames function called from Kotlin/Java |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.ourproject; | |
import android.os.Bundle; | |
import io.flutter.app.FlutterActivity; | |
import io.flutter.plugins.GeneratedPluginRegistrant; | |
import android.widget.Toast; | |
import io.flutter.plugin.common.MethodCall; | |
import io.flutter.plugin.common.MethodChannel; | |
import io.flutter.plugin.common.MethodChannel.MethodCallHandler; | |
import io.flutter.plugin.common.MethodChannel.Result; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.ourproject | |
import android.os.Bundle | |
import io.flutter.plugin.common.MethodChannel | |
import android.widget.Toast | |
import io.flutter.app.FlutterActivity | |
import io.flutter.plugins.GeneratedPluginRegistrant | |
class MainActivity: FlutterActivity() { | |
private val CHANNEL = "ourproject.sendstring" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class _MyHomePageState extends State<MyHomePage> { | |
static const platform = const MethodChannel('ourproject.sendstring'); | |
String receivedString = ""; | |
Future<void> callNativeFunction() async { | |
String msg = "Hello from Flutter",data=""; | |
try { | |
final String temp = await platform.invokeMethod('callSendStringFun',{"arg":msg}); | |
data = temp; | |
} on PlatformException catch (e) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyWidget extends StatefulWidget{ | |
_MyWidgetState createState() => _MyWidgetState(); | |
} | |
class _MyWidgetState extends State<MyWidget>{ | |
int num = 0; | |
@override | |
Widget build(BuildContext context){ | |
return Row( | |
children: <Widget>[ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyCard extends StatelessWidget{ | |
const MyCard({Key key, this.h, this.w}) : super(key:key); | |
final double h,w; | |
@override | |
Widget build(BuildContext context){ | |
return Card( | |
child: Container( | |
width: w, | |
height: h |
NewerOlder