๊ธฐ๋ณธ ์ฝ˜ํ…์ธ ๋กœ ๊ฑด๋„ˆ๋›ฐ๊ธฐ

์ถ”์ฒœ ๊ฒŒ์‹œ๋ฌผ

[Go] ๊ณ ๋ฃจํ‹ด

๋Ÿฐํƒ€์ž„(Runtime) visual code์—์„œ ๋ธŒ๋ผ์šฐ์ € ์‹คํ–‰ ๋‹จ์ถ•ํ‚ค: Alt+B Go runtime์€ ๋ฉ”๋ชจ๋ฆฌ ๊ด€๋ฆฌ, ๊ฐ€๋น„์ง€ ์ˆ˜์ง‘, ๋™์‹œ์„ฑ์„ ํฌํ•จํ•˜์—ฌ Go ํ”„๋กœ๊ทธ๋ฆผ์˜ ์‹คํ–‰์„ ๊ด€๋ฆฌํ•˜๋Š” ์—ญํ• ์„ ํ•ฉ๋‹ˆ๋‹ค. ์ด ๋ฌธ์„œ์—์„œ๋Š” Go runtime์„ ์ž์„ธํžˆ ์‚ดํŽด๋ณด๊ณ  ์•„ํ‚คํ…์ดˆ, ํŠน์„ฑ๊ณผ ์žฅ์ ์„ ์‚ดํŽด๋ด…๋‹ˆ๋‹ค. Go Runtime Architecture Go runtime์€ ๋ชจ๋“ˆ์‹์ด๊ณ  ์œ ์—ฐํ•˜๊ฒŒ ์„ค๊ณ„๋˜์—ˆ์œผ๋ฉฐ ๊ฐœ๋ฐœ์ž๊ฐ€ ํŠน์ • ์š”๊ตฌ์‚ฌํ•ญ์— ๋”ฐ๋ผ ๋™์ž‘์„ ์‚ฌ์šฉ์ž ์ •์˜ํ•  ์ˆ˜ ์žˆ๋Š” ๊ณ„์ธต์  ์•„ํ‚คํ…์ณ๋ฅผ ๊ฐ–์ถ”๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ๋Ÿฐํƒ€์ž„์€ ์Šค์ผ€์ค„๋Ÿฌ(schedualer), ๊ฐ€๋น„์ง€ ์ˆ˜์ง‘๊ธฐ(garbage collector), ๋ฉ”๋ชจ๋ฆฌ ํ• ๋‹น์ž(memory alllocator) ๋ฐ ์Šคํƒ๊ด€๋ฆฌ(stack management)๋ฅผ ํฌํ•จํ•œ ์–ด๋ ค ํ•ต์‹ฌ ๊ตฌ์„ฑ ์š”์†Œ๋กœ ๊ตฌ์„ฑ๋ฉ๋‹ˆ๋‹ค. Schedualer Go ๋Ÿฐํƒ€์ž„์˜ ํ•ต์‹ฌ์€ ๊ณ ๋ฃจํ‹ด์˜ ์‹คํ–‰์„ ๊ด€๋ฆฌํ•˜๋Š” ์Šค์ผ€์ค„๋Ÿฌ์ž…๋‹ˆ๋‹ค. ๊ณ ๋ฃจํ‹ด์€ ํšจ์œจ์ ์ธ ๋™์‹œ์„ฑ์„ ๊ฐ€๋Šฅํ•˜๊ฒŒ ํ•˜๋Š” ๊ฐ€๋ฒผ์šด ์Šค๋ ˆ๋“œ์ž…๋‹ˆ๋‹ค. ์Šค์ผ€์ค„๋Ÿฌ๋Š” ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ์Šค๋ ˆ๋“œ์— ๊ณ ๋ฃจํ‹ด์„ ๋ถ„์‚ฐํ•˜๊ณ , ์Šค๋ ˆ๋“œ ๋กœ์ปฌ ์Šคํ† ๋ฆฌ์ง€๋ฅผ ๊ด€๋ฆฌํ•˜๊ณ , I/O ์ž‘์—…์„ ์กฐ์ •ํ•˜๋Š” ์—ญํ• ์„ ํ•ฉ๋‹ˆ๋‹ค. thread(์Šค๋ ˆ๋“œ): ํ”„๋กœ๊ทธ๋žจ ๋‚ด์—์„œ ์‹คํ–‰๋˜๋Š” ํ๋ฆ„์˜ ๋‹จ์œ„๋กœ ๋™์‹œ์— ์—ฌ๋Ÿฌ ์ž‘์—…์ด๋‚˜ ํ”„๋กœ๊ทธ๋žจ์„ ์‹คํ–‰ํ•˜๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค. ์ฆ‰, ์ฝ”๋“œ๋ฅผ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ๋Š” ๊ฐ ๋‹จ์œ„๋ฅผ ์Šค๋ ˆ๋“œ๋ผ๊ณ  ํ•ฉ๋‹ˆ๋‹ค. ๊ณ ๋ฃจํ‹ด(goroutine): Go ์–ธ์–ด๋กœ ๋™์‹œ์— ์‹คํ–‰๋˜๋Š” ๋ชจ๋“  ํ™œ๋™์„ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค. ๊ณ ๋ฃจํ‹ด์„ ๋งŒ๋“œ๋Š” ๋น„์šฉ์„ ์Šค๋ ˆ๋“œ์— ๋น„ํ•ด ๋งค์šฐ ์ ๊ธฐ ๋–„๋ฌธ์— ๊ฒฝ๋Ÿ‰ ์Šค๋ ˆ๋“œ๋ผ๊ณ  ํ•ฉ๋‹ˆ๋‹ค. ๋ชจ๋“  ํ”„๋กœ๊ทธ๋žจ์€ ์ ์–ด๋„ ํ•˜๋‚˜์˜ main() ํ•จ์ˆ˜๋ผ๋Š” ๊ณ ๋ฃจํ‹ด์„ ํฌํ•จํ•˜๊ณ  ๊ณ ๋ฃจํ‹ด์€ ํ•ญ์ƒ ๋ฐฑ๊ทธ๋ผ์šด๋“œ์—์„œ ์ž‘๋™ํ•ฉ๋‹ˆ๋‹ค. ๋ฉ”์ธํ•จ์ˆ˜๊ฐ€ ์ข…๋ฃŒ๋˜๋ฉด ๋ชจ๋“  ๊ณ ๋ฃจํ‹ด์€ ์ข…๋ฃŒ๋ฉ๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋ฏ€๋กœ ๊ณ ๋ฃจํ‹ด๋ณด๋‹ค main์ด ๋จผ์ € ์ข…๋ฃŒ๋˜๋Š” ๊ฒƒ์„ ๋ฐฉ์ง€ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. Go ์Šค์ผ€์ค„๋Ÿฌ๋Š” ๋งค์šฐ ํšจ์œจ์ ์ด๊ณ  ํ™•์žฅ ๊ฐ€๋Šฅํ•˜๋„๋ก ์„ค๊ณ„๋˜์–ด ๋งŽ์€ ์ˆ˜์˜ ๋™์‹œ ๊ณ ๋ฃจํ‹ด์„ ์†์‰ฝ๊ฒŒ ์ฒ˜๋ฆฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์Šค๋ ˆ๋“œ ๊ฐ„์— ๋ถ€ํ•˜๋ฅผ ๋ถ„์‚ฐํ•˜์—ฌ ๊ฒฝํ•ฉ์„ ์ตœ์†Œํ™”ํ•˜๊ณ  ์„ฑ๋Šฅ์„ ๊ฐœ์„ ํ•˜๋Š” ์ž‘์—… ํ›”์น˜๊ธฐ ์•Œ๊ณ ๋ฆฌ์ฆ˜์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค...

[kotlin]Smart Cast & Any type in Kotlin



Smart Cast

In Kotlin, data types have the following meanings:

1) Define the size in which the object is stored
2) Whether objects are replaced or not. That is, they must have the same data type to execute.

For example, the operation of Int type and Double type is not performed.

val a: Int = 17
val b: Double= a
println(b)
     error: type mismatch: inferred type is Int but Double was expected
                  val b: Double= a

The assignment of a to object b is not done because the data types of objects a and b are different.
When using a data type to which a smart cast is applied, the data type is specified according to the assigned value.
The Number type is a data type to which a representative smart cast for numbers is applied.
Therefore, if the Number type is applied in the above case, it is as follows.

val a: Int = 17
val b: Number=a
println(b)
     17

In the code above, a is of type Int. For object b specified by Number, the data type is determined by the assigned value.

val a: Int = 17
var b: Number=a
println(b)
     17

b is Int
     res12: kotlin.Boolean = true

b=3.14
b
     res13: kotlin.Number = 3.14

b is Double
     res14: kotlin.Boolean = true

In the code above, b is a data type depending on the value passed to the object.

Any

"Any" is a data type that has the same process as smart cast.

"Any" is the superclass at the top of every class written by kotlin.
In other words, any class can inherit "Any".

As a result, variable declared as "Any" means that various kinds of values can be assigned.

var a: Any=3
a is Int
     res15: kotlin.Boolean = true

a=3.14
a is Double
     res16: kotlin.Boolean = true

a="kotlin"
a
     res17: kotlin.Any = kotlin
a is String
     res18: kotlin.Boolean = true

๋Œ“๊ธ€

์ด ๋ธ”๋กœ๊ทธ์˜ ์ธ๊ธฐ ๊ฒŒ์‹œ๋ฌผ

[python]KeyWord

keywords Characters or strings already used to define basic commands in programming languages such as python are called reserved words. This reserved word cannot be used when defining objects such as variables, functions, and classes when coding by the user. python has 33 reserved words, and it distinguishes between lowercase and uppercase letters in Engolsh. All other keywords are lowercase except True, False, None, etc. a and, as, assert, async, await b break c class, continue d def, del e eolf, else, except f False, finally, for, from g global i in, if, import, is l lambda n nonlocal, None, not o or r raise, return p pass ...

[Go] ๊ณ ๋ฃจํ‹ด

๋Ÿฐํƒ€์ž„(Runtime) visual code์—์„œ ๋ธŒ๋ผ์šฐ์ € ์‹คํ–‰ ๋‹จ์ถ•ํ‚ค: Alt+B Go runtime์€ ๋ฉ”๋ชจ๋ฆฌ ๊ด€๋ฆฌ, ๊ฐ€๋น„์ง€ ์ˆ˜์ง‘, ๋™์‹œ์„ฑ์„ ํฌํ•จํ•˜์—ฌ Go ํ”„๋กœ๊ทธ๋ฆผ์˜ ์‹คํ–‰์„ ๊ด€๋ฆฌํ•˜๋Š” ์—ญํ• ์„ ํ•ฉ๋‹ˆ๋‹ค. ์ด ๋ฌธ์„œ์—์„œ๋Š” Go runtime์„ ์ž์„ธํžˆ ์‚ดํŽด๋ณด๊ณ  ์•„ํ‚คํ…์ดˆ, ํŠน์„ฑ๊ณผ ์žฅ์ ์„ ์‚ดํŽด๋ด…๋‹ˆ๋‹ค. Go Runtime Architecture Go runtime์€ ๋ชจ๋“ˆ์‹์ด๊ณ  ์œ ์—ฐํ•˜๊ฒŒ ์„ค๊ณ„๋˜์—ˆ์œผ๋ฉฐ ๊ฐœ๋ฐœ์ž๊ฐ€ ํŠน์ • ์š”๊ตฌ์‚ฌํ•ญ์— ๋”ฐ๋ผ ๋™์ž‘์„ ์‚ฌ์šฉ์ž ์ •์˜ํ•  ์ˆ˜ ์žˆ๋Š” ๊ณ„์ธต์  ์•„ํ‚คํ…์ณ๋ฅผ ๊ฐ–์ถ”๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ๋Ÿฐํƒ€์ž„์€ ์Šค์ผ€์ค„๋Ÿฌ(schedualer), ๊ฐ€๋น„์ง€ ์ˆ˜์ง‘๊ธฐ(garbage collector), ๋ฉ”๋ชจ๋ฆฌ ํ• ๋‹น์ž(memory alllocator) ๋ฐ ์Šคํƒ๊ด€๋ฆฌ(stack management)๋ฅผ ํฌํ•จํ•œ ์–ด๋ ค ํ•ต์‹ฌ ๊ตฌ์„ฑ ์š”์†Œ๋กœ ๊ตฌ์„ฑ๋ฉ๋‹ˆ๋‹ค. Schedualer Go ๋Ÿฐํƒ€์ž„์˜ ํ•ต์‹ฌ์€ ๊ณ ๋ฃจํ‹ด์˜ ์‹คํ–‰์„ ๊ด€๋ฆฌํ•˜๋Š” ์Šค์ผ€์ค„๋Ÿฌ์ž…๋‹ˆ๋‹ค. ๊ณ ๋ฃจํ‹ด์€ ํšจ์œจ์ ์ธ ๋™์‹œ์„ฑ์„ ๊ฐ€๋Šฅํ•˜๊ฒŒ ํ•˜๋Š” ๊ฐ€๋ฒผ์šด ์Šค๋ ˆ๋“œ์ž…๋‹ˆ๋‹ค. ์Šค์ผ€์ค„๋Ÿฌ๋Š” ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ์Šค๋ ˆ๋“œ์— ๊ณ ๋ฃจํ‹ด์„ ๋ถ„์‚ฐํ•˜๊ณ , ์Šค๋ ˆ๋“œ ๋กœ์ปฌ ์Šคํ† ๋ฆฌ์ง€๋ฅผ ๊ด€๋ฆฌํ•˜๊ณ , I/O ์ž‘์—…์„ ์กฐ์ •ํ•˜๋Š” ์—ญํ• ์„ ํ•ฉ๋‹ˆ๋‹ค. thread(์Šค๋ ˆ๋“œ): ํ”„๋กœ๊ทธ๋žจ ๋‚ด์—์„œ ์‹คํ–‰๋˜๋Š” ํ๋ฆ„์˜ ๋‹จ์œ„๋กœ ๋™์‹œ์— ์—ฌ๋Ÿฌ ์ž‘์—…์ด๋‚˜ ํ”„๋กœ๊ทธ๋žจ์„ ์‹คํ–‰ํ•˜๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค. ์ฆ‰, ์ฝ”๋“œ๋ฅผ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ๋Š” ๊ฐ ๋‹จ์œ„๋ฅผ ์Šค๋ ˆ๋“œ๋ผ๊ณ  ํ•ฉ๋‹ˆ๋‹ค. ๊ณ ๋ฃจํ‹ด(goroutine): Go ์–ธ์–ด๋กœ ๋™์‹œ์— ์‹คํ–‰๋˜๋Š” ๋ชจ๋“  ํ™œ๋™์„ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค. ๊ณ ๋ฃจํ‹ด์„ ๋งŒ๋“œ๋Š” ๋น„์šฉ์„ ์Šค๋ ˆ๋“œ์— ๋น„ํ•ด ๋งค์šฐ ์ ๊ธฐ ๋–„๋ฌธ์— ๊ฒฝ๋Ÿ‰ ์Šค๋ ˆ๋“œ๋ผ๊ณ  ํ•ฉ๋‹ˆ๋‹ค. ๋ชจ๋“  ํ”„๋กœ๊ทธ๋žจ์€ ์ ์–ด๋„ ํ•˜๋‚˜์˜ main() ํ•จ์ˆ˜๋ผ๋Š” ๊ณ ๋ฃจํ‹ด์„ ํฌํ•จํ•˜๊ณ  ๊ณ ๋ฃจํ‹ด์€ ํ•ญ์ƒ ๋ฐฑ๊ทธ๋ผ์šด๋“œ์—์„œ ์ž‘๋™ํ•ฉ๋‹ˆ๋‹ค. ๋ฉ”์ธํ•จ์ˆ˜๊ฐ€ ์ข…๋ฃŒ๋˜๋ฉด ๋ชจ๋“  ๊ณ ๋ฃจํ‹ด์€ ์ข…๋ฃŒ๋ฉ๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋ฏ€๋กœ ๊ณ ๋ฃจํ‹ด๋ณด๋‹ค main์ด ๋จผ์ € ์ข…๋ฃŒ๋˜๋Š” ๊ฒƒ์„ ๋ฐฉ์ง€ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. Go ์Šค์ผ€์ค„๋Ÿฌ๋Š” ๋งค์šฐ ํšจ์œจ์ ์ด๊ณ  ํ™•์žฅ ๊ฐ€๋Šฅํ•˜๋„๋ก ์„ค๊ณ„๋˜์–ด ๋งŽ์€ ์ˆ˜์˜ ๋™์‹œ ๊ณ ๋ฃจํ‹ด์„ ์†์‰ฝ๊ฒŒ ์ฒ˜๋ฆฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์Šค๋ ˆ๋“œ ๊ฐ„์— ๋ถ€ํ•˜๋ฅผ ๋ถ„์‚ฐํ•˜์—ฌ ๊ฒฝํ•ฉ์„ ์ตœ์†Œํ™”ํ•˜๊ณ  ์„ฑ๋Šฅ์„ ๊ฐœ์„ ํ•˜๋Š” ์ž‘์—… ํ›”์น˜๊ธฐ ์•Œ๊ณ ๋ฆฌ์ฆ˜์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค...

๋งค๊ฐœ๋ณ€์ˆ˜ ์ถ”์ • ๋„๊ตฌ: PDF, CDF ๋ฐ ๋ถ„์œ„์ˆ˜ ํ•จ์ˆ˜

๋งค๊ฐœ๋ณ€์ˆ˜ ์ถ”์ • ๋„๊ตฌ: PDF, CDF ๋ฐ ๋ถ„์œ„์ˆ˜ ํ•จ์ˆ˜ ํ™•๋ฅ  ๋ฐ€๋„ ํ•จ์ˆ˜(PDF)์— ๋Œ€ํ•ด ์ž์„ธํžˆ ๋‹ค๋ฃจ๊ณ , ๊ฐ’ ๋ฒ”์œ„์˜ ํ™•๋ฅ ์„ ๋ณด๋‹ค ์‰ฝ๊ฒŒ ๊ฒฐ์ •ํ•˜๋Š” ๋ฐ ๋„์›€์ด ๋˜๋Š” ๋ˆ„์  ๋ถ„ํฌ ํ•จ์ˆ˜(CDF)๋ฅผ ์†Œ๊ฐœํ•˜๊ณ , ํ™•๋ฅ  ๋ถ„ํฌ๋ฅผ ๋™์ผํ•œ ํ™•๋ฅ ๋กœ ๋‚˜๋ˆ„๋Š” ๋ถ„์œ„์ˆ˜๋ฅผ ์†Œ๊ฐœํ•ฉ๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด, ๋ฐฑ๋ถ„์œ„์ˆ˜๋Š” 100๋ถ„์œ„์ˆ˜์ด๋ฉฐ, ์ด๋Š” ํ™•๋ฅ  ๋ถ„ํฌ๋ฅผ 100๊ฐœ์˜ ๋™์ผํ•œ ๋ถ€๋ถ„์œผ๋กœ ๋‚˜๋ˆˆ๋‹ค๋Š” ๊ฒƒ์„ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค. ์ด๋ฉ”์ผ ๊ฐ€์ž… ๋ชฉ๋ก์— ๋Œ€ํ•œ ์ „ํ™˜์œจ ์ถ”์ • ๋ธ”๋กœ๊ทธ๋ฅผ ์šด์˜ํ•˜๊ณ  ๋ธ”๋กœ๊ทธ ๋ฐฉ๋ฌธ์ž๊ฐ€ ์ด๋ฉ”์ผ ๋ชฉ๋ก์— ๊ฐ€์ž…ํ•  ํ™•๋ฅ ์„ ์•Œ๊ณ  ์‹ถ๋‹ค๊ณ  ๊ฐ€์ •ํ•ด ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. ๋งˆ์ผ€ํŒ… ์šฉ์–ด๋กœ ์‚ฌ์šฉ์ž๊ฐ€ ์›ํ•˜๋Š” ์ด๋ฒคํŠธ๋ฅผ ์ˆ˜ํ–‰ํ•˜๋„๋ก ํ•˜๋Š” ๊ฒƒ์„ ์ „ํ™˜ ์ด๋ฒคํŠธ ๋˜๋Š” ๊ฐ„๋‹จํžˆ ์ „ํ™˜์ด๋ผ๊ณ  ํ•˜๋ฉฐ, ์‚ฌ์šฉ์ž๊ฐ€ ๊ฐ€์ž…ํ•  ํ™•๋ฅ ์„ ์ „ํ™˜์œจ์ด๋ผ๊ณ  ํ•ฉ๋‹ˆ๋‹ค. ๊ตฌ๋…์ž ์ˆ˜ k์™€ ๋ฐฉ๋ฌธ์ž ์ด ์ˆ˜ n์„ ์•Œ๊ณ  ์žˆ์„ ๋•Œ ๊ตฌ๋… ํ™•๋ฅ  p๋ฅผ ์ถ”์ •ํ•˜๊ธฐ ์œ„ํ•ด ๋ฒ ํƒ€ ๋ถ„ํฌ๋ฅผ ์‚ฌ์šฉํ•  ๊ฒƒ์ž…๋‹ˆ๋‹ค. ๋ฒ ํƒ€ ๋ถ„ํฌ์— ํ•„์š”ํ•œ ๋‘ ๊ฐ€์ง€ ๋งค๊ฐœ๋ณ€์ˆ˜๋Š” ฮฑ๋กœ, ์ด ๊ฒฝ์šฐ ๊ตฌ๋…์ž ์ด ์ˆ˜(k)๋ฅผ ๋‚˜ํƒ€๋‚ด๊ณ , ฮฒ๋Š” ๊ตฌ๋…ํ•˜์ง€ ์•Š์€ ์ด ์ˆ˜(n – k)๋ฅผ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค. ํ™•๋ฅ  ๋ฐ€๋„ ํ•จ์ˆ˜ ์ฒซ 40,000๋ช…์˜ ๋ฐฉ๋ฌธ์ž์— ๋Œ€ํ•ด 300๋ช…์˜ ๊ตฌ๋…์ž๋ฅผ ์–ป๋Š”๋‹ค๊ณ  ๊ฐ€์ •ํ•ด ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. ์šฐ๋ฆฌ ๋ฌธ์ œ์— ๋Œ€ํ•œ PDF๋Š” ฮฑ = 300์ด๊ณ  ฮฒ = 39,700์ธ ๋ฒ ํƒ€ ๋ถ„ํฌ์ž…๋‹ˆ๋‹ค. ๋ฒ ํƒ€ ๋ถ„ํฌ์˜ ํ‰๊ท  ๊ณ„์‚ฐ $$\tag{1}\mu_{\text{beta}}=\frac{\alpha}{\alpha + \beta}$$ ์‹ 1์„ ์‚ฌ์šฉํ•˜์—ฌ ๋ฐฉ๋ฌธ์ž ์ค‘์˜ ๊ตฌ๋…์ž์— ๋Œ€ํ•œ ํ‰๊ท ์€ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ๊ณ„์‚ฐ๋ฉ๋‹ˆ๋‹ค. import numpy as np import pandas as pd from scipy import stats, special import itertools from sympy import * import matplotlib.pyplot as plt import seaborn as sns sns.set_style("darkgrid") def decorate_plot(xlab, ylab, title=None, size=(4,3)): plt.figu...