Data science and artificial intelligence technology note I, vectors, matrices and arrays
I. vector, matrix and array
Author: Chris Albon
Translator: Flying dragon
Agreement: CC BY-NC-SA 4.0
Transpose matrix or vector
# Loading Library
import numpy as np
# Create vector
vector = np.array([1, 2, 3, 4, 5, 6])
# Create matrix
matrix = np.array([[1, 2, 3],
[4, 5, 6],
[7, 8, 9]])
# ...
Posted by sports on Sun, 08 Dec 2019 03:19:25 -0800
Kotlin core syntax: higher order functions, Lambda as parameter and return value
Blog Homepage
1. Declare higher-order functions
A higher-order function is one that takes another function as a parameter or return value. In kotlin, functions can be represented by lambda or function references.For example, the filter function in the standard library takes a judging function as a parameter, so it is a higher-order function
lis ...
Posted by renegade44 on Sat, 07 Dec 2019 10:40:46 -0800
Details of IEnumerable and IEnumerator
Introduction
IEnumerable is the base interface of all non generic collections that can be enumerated. IEnumerable contains a method GetEnumerator(), which returns an IEnumerator. IEnumerator provides the function of circular access to the collection through the Current property and MoveNext() and Reset() methods.
IEnumerable interface
Exposes e ...
Posted by Placebo on Sat, 07 Dec 2019 02:34:06 -0800
Create notifications using entry points for SpringAOP
Several notification types in SpringAOP and how to create simple notifications have been described previously See address
1. What is the starting point
In the previous example, we could create a ProxyFactory to create notifications and get the methods in the target class.Different types of notifications allow you to do different things with the ...
Posted by jamesl on Fri, 06 Dec 2019 23:37:43 -0800
How do I sort dictionary lists by dictionary values?
I have a list of dictionaries that I want each item to be sorted by a specific attribute value.
Consider the following array,
[{'name':'Homer', 'age':39}, {'name':'Bart', 'age':10}]
When sorting by name, it should be
[{'name':'Bart', 'age':10}, {'name':'Homer', 'age':39}]
#1st floor
Using Perl's Schwartzian transformation,
py ...
Posted by fatnjazzy on Fri, 06 Dec 2019 13:00:39 -0800
Common functions of python and Keras.backend
python common functions (v3.0)
lambda anonymous function
# lambda <params>:<result>
func = lambda x, y: x + y
print(func(1, 2))
# Output 3
map function
Pass one or more elements in sequnce as parameters to func for execution, and return the result of function execution as an iterator.
# map(func, sequnce[, sequnce,.... ...
Posted by TheoGB on Fri, 06 Dec 2019 11:29:36 -0800
Python practice [6] [database operation | file reading and writing]
1. Review topics of object-oriented, file operation and database operation:
The file score.dat holds the names of 100 students and their Python lessons, advanced mathematics and English scores.
(1) define the student class, including name, Python class, advanced mathematics and English scores, total score and average score data members, and ...
Posted by ericwright17 on Fri, 06 Dec 2019 06:45:52 -0800
Some built-in functions of python
Built in function mind map: https://www.processon.com/mindmap/5c10ca52e4b0c2ee256ac034
Built-in function
Anonymous function
The unified name of anonymous function is: < lambda >
Usage scenario: used with sorted, map and filter
fn = lambda a, b : a + b # Define a very simple function. Do not use complex functions lambda
ret = fn(3, 5)
p ...
Posted by jimbob on Thu, 05 Dec 2019 01:16:29 -0800
jdk8foreach mass creation object optimization
jdk8 foreach creation object optimization
lambda foreach creating objects
@Async
public void asyncFullEsDoc() {
List<Integer> docIdList = Arrays.asList(913,914);
if (CollectionUtil.isNotNullOrEmpty(docIdList)){
List<Document> documents = new ArrayList<>(500);
docIdList.forEa ...
Posted by padanaram on Wed, 04 Dec 2019 19:14:09 -0800
Startup configuration for getting started with NetCore 2.0 MVC
Just contacted netcore, the following configuration instructions I am using and some points to be injected
1. I don't want to use constructor injection in my project, so I refer to the third-party Autofac package to manage my service. In the controller, I just need to create public iClass class{get;set;}
2. I use dll reflection to inject serv ...
Posted by powerspike on Wed, 04 Dec 2019 01:09:58 -0800