This file contains hidden or 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
| precision | recall | f1-score | support | ||
|---|---|---|---|---|---|
| Iris-setosa | 1.00 | 1.00 | 1.00 | 7 | |
| Iris-versicolor | 1.00 | 0.88 | 0.93 | 8 | |
| Iris-virginica | 0.94 | 1.00 | 0.97 | 15 | |
| avg/total | 0.97 | 0.97 | 0.97 | 30 |
This file contains hidden or 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
| Graph<ClosedShape, Consumer.Control> completionStageGraph = GraphDSL.create(source, (builder, sourceShape) -> { | |
| // Add Broadcast | |
| // Add Flows | |
| // Add Sinks | |
| builder | |
| .from(...) | |
| .viaFanOut(...) | |
| .via(...) | |
| .to(...); |
This file contains hidden or 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
| from enum import Enum | |
| class ConditionOperator(Enum): | |
| EQ ='EQ' | |
| LTE ='LTE' | |
| GTE = 'GTE' | |
| print(ConditionOperator.EQ.name) ## EQ |
This file contains hidden or 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
| itemCost = {'item1': 100, 'item2': 10, 'item3': 5} | |
| # Get value using Key | |
| print(itemCost['item1']) | |
| # Put value | |
| itemCost["item4"] = 99 | |
| # Length of the dictionary | |
| print(len(itemCost)) |
This file contains hidden or 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
| # Complex Nested tuple | |
| complexNestedTuple = ("Alice", [12.4, 34], ('Male', 'Age')) | |
| print(complexNestedTuple) ## ('Alice', [12.4, 34], ('Male', 'Age')) |
This file contains hidden or 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
| # List of users | |
| list = ['Deli','Corn', 'Alice', 'Bob'] | |
| # Length of the user list | |
| print('List Length', len(list)) | |
| # List slice | |
| print(list[1:3]) ## ['Corn', 'Alice'] -> include element at index 1 and exclude elememnt at index 3 | |
| # Sorting:: sort function doesn't return a value! But 'list' should have sorted. | |
| list.sort() |
This file contains hidden or 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
| # String examples | |
| str = 'Python' | |
| print str[0] ## P | |
| print len(str) ## 6 | |
| print str + ' py' ## Python py | |
| # String Slice | |
| print str[2:4] ## th -> include index 2 and exclude index 4 | |
| print str[:] ## Python |
This file contains hidden or 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
| # import modules used here. sys is a very standard module | |
| import sys | |
| # Entry point to stand alone program i.e. main() | |
| def main(): | |
| print('Hello World!') | |
| # Call the main() to begin the execution | |
| # This module can run directly with below code! Else it can used as a import in another module! | |
| if __name__ == '__main__': |
This file contains hidden or 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
| def excludeColumnAtIndex(self, dataset, indexToExclude): | |
| “””Exclude the complete specific column values | |
| from the given dataset. “”” | |
| # code goes her |
This file contains hidden or 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
| Map<String, Optional<Integer>> highestDeviceCostCustomerPaid = consumerList | |
| .stream() | |
| .flatMap(consumer -> consumer.getThings() | |
| .stream() | |
| .map(thing -> new AbstractMap.SimpleImmutableEntry<>(consumer.getName(), thing.getCost())) | |
| ) | |
| .collect(Collectors.groupingBy(entry -> entry.getKey(), | |
| Collectors.mapping(entry -> entry.getValue(), Collectors.maxBy(Comparator.comparingInt(value -> value))))); | |
| System.out.println(highestDeviceCostCustomerPaid); |
NewerOlder